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

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


Platform tested against:

Android 2.2 (PhoneGap)


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.


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.

20 Apr 2011, 6:55 AM

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

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

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

5 Jun 2011, 4:38 AM

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

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.

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

This bug still exists in ST 2.x

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

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.

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


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

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;

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.

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://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)

14 Jul 2017, 1:26 AM
How do i Check the GPS if is ON on the Android and iOS and how do i enable GPS