4

I have a Sencha app which performs geolocation, and provides a list of nearby venues based on the results.

I am using PhoneGap:Build (the automated service); this point might be of importance. I am not dealing with the PhoneGap files at all - I am letting PhoneGap:Build automatically create the apps for all platforms. So far it has been spectacular.

The problem: I understand that attempting to geolocate before 'deviceready' is triggered may result in a geolocation call using the Safari geolocation instead of the device geolocation. The side-effect I am experiencing is this terrible message prompt:

'/var/mobile/Applications/XXXX-XXXX-XXXX-XXXXXXXXXXX/AppName.app/www/index.html would like to use your current location'

Now, this is still happening after I introduce even a 10 second delay - long enough to ensure that PhoneGap has long since been loaded. This is where I am confused. This only happens in iOS; Android build seems fine.

Why am I getting this message? I have the following line in my config.xml:

<feature name="http://api.phonegap.com/1.0/geolocation"/>

..Which I figured was sufficient to open up the PhoneGap geolocation API, thus avoiding this horrible message.

I should also note that I get double prompted; the first time geolocation is performed, I get this:

'App Name would like to use your location'

Which is then followed by a second message - the ugly one I outlined above.

Why are two prompts being displayed back-to-back? Why not just the first one? I've spent days on this.. completely out of ideas. Please help!

Matthew Housser
  • 1,012
  • 9
  • 21

1 Answers1

1

This same issue is addressed here.

Basically they again take you here.

which explains a fairly in depth process but at least it works.

Community
  • 1
  • 1
Lofar
  • 36
  • 3
  • Currently, there is much easier solution posted to that question -- you have to make sure, you're calling geolocation API **after device is ready**, to see application name, not URL, requesting for location permission -- see [here](http://stackoverflow.com/a/5018461/1469208) for more details. – trejder May 28 '13 at 21:34