PDA

View Full Version : [FIXED] [OPEN TOUCH-137] enableHighAccuracy/allowHighAccuracy in GeoLocation



VinylFox
14 Apr 2011, 4:20 PM
Sencha Touch version tested:

1.1


Platform tested against:

Android 2.2 (PhoneGap)


Description:

The setting used to enable high accuracy (GPS based) geolocation was changed in 0.99 release to be 'allowHighAccuracy' instead of the standardized 'enableHighAccuracy' property that is defined in the w3c spec. This typo makes it impossible to get a GPS based location update when using PhoneGap, since PhoneGap follows the specifications exactly and will not access the GPS for a location unless 'enableHighAccuracy' is set to true. The change was made in the 0.99 release (http://www.sencha.com/forum/showthread.php?102973-Sencha-Touch-Releases-amp-Notes-(1.0RC)) and has been that way ever since. The following override fixes this problem - I just made the minimal change to get it working, but you might consider fixing the name of the property as it's used in the GeoLocation configuration to match the standard 'enableHighAccuracy' property.


Fix:



Ext.override(Ext.util.GeoLocation,{
parseOptions: function(){
var ret = {
maximumAge: this.maximumAge,
enableHighAccuracy: this.allowHighAccuracy
};
//Google doesn't like Infinity
if(this.timeout !== Infinity){
ret.timeout = this.timeout;
}
return ret;
}
});


See this URL for the w3 spec: http://dev.w3.org/geo/api/spec-source.html#high-accuracy

My Git repo is all messed up right now, so I can't commit this change myself, hopefully someone else can take care of it for me.

VinylFox
20 Apr 2011, 6:55 AM
Bump

VinylFox
27 Apr 2011, 5:50 AM
2 weeks and not even a tag.

VinylFox
4 May 2011, 2:53 AM
How is this fix not a priority?

Trixor
4 May 2011, 7:18 AM
I agree with VinylFox. Please apply the fix.

VinylFox
5 Jun 2011, 4:38 AM
*bump*

mike.estes
5 Jun 2011, 7:23 AM
Thank you for reporting this, filed as TOUCH-137

cdg10620
12 Oct 2011, 6:48 AM
I have encountered this same issue. We were working on an application and wanted the application to use a higher accuracy GPS if it was available. After digging in the source we saw the issue that @VinylFox has stated here. After changing the #Sencha source the GPS functionality improved dramatically.

VinylFox
12 Oct 2011, 6:57 AM
Seems that this bug has fallen through the cracks.

This bug still exists in ST 2.x

rdougan
19 Apr 2012, 2:58 PM
Fixed. Will be in a future version of Sencha Touch 2. Thanks.

VinylFox
27 Apr 2012, 12:56 PM
It took a year to fix a bug I provided you guys with the fix for in a clearly stated and researched bug report.

RossGerbasi
8 May 2012, 1:50 PM
I love sencha, trust me I do. I am just confused as to how this bug is STILL in ST 2.0.1.

Path: \sdk\src\util
File: Geolocation.js
Line: 375

Currently:


allowHighAccuracy: this.getAllowHighAccuracy()


Change to


enableHighAccuracy: this.getAllowHighAccuracy()


Pretty Please...

For those trying to get this fixed now add the following code for ST2.0.1



Ext.override(Ext.util.GeoLocation,{
parseOptions: function(){
var timeout = this.getTimeout(),
ret = {
maximumAge: this.getMaximumAge(),
enableHighAccuracy: this.getAllowHighAccuracy()
};


//Google doesn't like Infinity
if (timeout !== Infinity) {
ret.timeout = timeout;
}
return ret;
}
});

clifficious
26 Jun 2012, 1:42 AM
I'm actually not sure if this has really been fixed.....

@chaoswarp: thanks for your workaround. Unbelievable that this is still not fixed!
Seems that my device is now searching for GPS, but just for a second and then uses the default network location. I'll have to dig deeper into it.

Möhre
14 Aug 2012, 6:17 AM
S (http://stackoverflow.com/questions/9925289/how-to-get-user-position-by-gps-in-sencha)eems to be fixed since 2.0.2?!

http://dev.sencha.com/deploy/sencha-touch-2.1.0-b2/release-notes.html

http://stackoverflow.com/questions/9925289/how-to-get-user-position-by-gps-in-sencha (http://dev.sencha.com/deploy/sencha-touch-2.1.0-b2/release-notes.html)