20 Feb 2013 8:25 PM #1
Geolocation permission request fires twice on native builds fo iOS
in my app I use Ext.Map component, so at the first start of app on IPhone user will get a request for using location permissions. As expected this question should be asked a single time only, but it happened twice.
The first time question is "App would like to use your current location"..
and the second time something like "/var/mobile/Applications/246JF70D-4BB7-736G-870D0VHE1T/app.app/app/index.html would like to use your location"
What happened? Why this occurs?
22 Feb 2013 8:47 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
When packaged, what are you using to get the location?Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services email@example.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
22 Feb 2013 10:15 AM #3
as I know, Ext.Map uses Ext.util.Geolocation
6 Mar 2013 12:22 AM #4
Have you already find the solution on this? I have the same problem.
6 Mar 2013 12:33 AM #5
Yes. You should initialize geolocation services after application DOM is created, for example you can initialize gelocation on "painted" event on Ext.Viewport.
If you use Ext.Map component (uses Ext.util.Geolocation) you should initialize this component with useCurrentLocation config option - false. Important!
Also you should listen for painted event on Ext.Viewport, when this event fires - you can enable geolocation service on Ext.Map by setting mpObj.setUseCurrentLocation(true);
6 Mar 2013 4:50 AM #6
Actually I just fixed mine by using Ext.device.Geolocation.getCurrentPosition()
19 Aug 2013 8:46 AM #7
I'm building a native ios app, and I obtain the double location permission request when using "navigator.geolocation.getCurrentPosition".
I've tried what you said and put the call inside the "painted" listener on my Panel... but unfortunately I still obtain the double permission request. I use the geolocation to send a GET Request along with coordinates to a server that returns a json with information that I use to fill a list.
Any idea about how to avoid this annoying prompt? I've read something about "deviceready" and phonegap, but I don't use phonegap...
I can't use Ext.device.Geolocation.getCurrentPosition because fails when it's used on natives apps on IOS.
Thank you very much.
29 Aug 2013 10:49 AM #8
29 Dec 2013 2:11 PM #9
I am also having this problem, there doesn't seem to be any way to have the location services request fire just once... really frustrating.
29 Dec 2013 2:44 PM #10
I think I just fixed my problem on iOs at least, I had to include the GeoLocation plugin from Cordova into my build... I think what happens is that the HTML5 device gets found if the plugin doesn't override it... you can read about it on the plugin page:
and there were helpful notes on another thread: