yogi
yogi

Reputation: 1367

PhoneGap geolocation asks for permission twice on iPhone

My app uses navigator.geolocation provided by PhoneGap. When running the app on iPhone is asks for location permissions twice, i guess one for the app and one for safari, how do i solve this?

Upvotes: 5

Views: 5798

Answers (4)

soumya
soumya

Reputation: 3811

Call the geolocation initialisation in onDeviceReady Method and load this in body tag

function onDeviceReady(){
    return navigator.geolocation.getCurrentPosition(initialize);
}

Upvotes: 1

Manuel
Manuel

Reputation: 19

I think i found the solution, at least did it work for me: some files of the geolocation plugin were missing! You can find my solution here.

Upvotes: 0

Michael Belt
Michael Belt

Reputation: 36

I was having the same problem, but this fixed it: Location permission alert on iPhone with PhoneGap

you have to rely on OnDeviceReady(), and it'll only call once.

Upvotes: 2

kirb
kirb

Reputation: 2049

Unfortunately, you can't disable the second alert, because it is coming from WebKit and not iOS. However, I suggest you write a bug on the WebKit Bugzilla and ask them to disable the second alert when PhoneGap is being used in an app if you believe two confirmation messages will be confusing to the user.

Ad@m

Upvotes: 0

Related Questions