Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I just got bit by this too.</p> <p>It turns out there's a bug in Sencha: in <a href="http://docs.sencha.com/touch/2-0/source/Geolocation.html#Ext-util-Geolocation" rel="nofollow">Ext.util.Geolocation.parseOption</a> they name the parameter <code>allowHighAccuracy</code> but <a href="http://dev.w3.org/geo/api/spec-source.html" rel="nofollow">the w3c specs</a> name it <code>enableHighAccuracy</code>. I added the following code to my application init to fix that:</p> <pre><code>var parseOptions = function() { var timeout = this.getTimeout(), ret = { maximumAge: this.getMaximumAge(), // Originally spells *allowHighAccurancy* enableHighAccuracy: this.getAllowHighAccuracy() }; //Google doesn't like Infinity if (timeout !== Infinity) { ret.timeout = timeout; } return ret; }; Ext.util.Geolocation.override('parseOptions', parseOptions); </code></pre> <p>For the record: the bug <a href="http://www.sencha.com/forum/showthread.php?130292-OPEN-TOUCH-137-enableHighAccuracy-allowHighAccuracy-in-GeoLocation" rel="nofollow">has been reported over a year ago</a>, and <code>the fix was applied for TOUCH-2804 in a recent build</code>. I don't know what that means, but sure enough the bug is still in 2.0</p> <p>EDIT: using the approach mentioned above doesn't work well either. The GPS icon would turn on and off as Exts calls getCurrentPosition repeatedly using a setInterval. The reason for doing this is that <code>The native watchPosition method is currently broken in iOS5</code>. In my Android targeted application I ended up ditching Ext:util.Geolocation and directely used navigator.geolocation.watchPosition. After that it worked like a charm.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload