开发者

PhoneGap geolocation asks for permission twice on iPhone

开发者 https://www.devze.com 2023-03-31 13:18 出处:网络
My app uses navigator.geolocation provided by PhoneGap. When running the app on iPhone is asks for location permissions twi开发者_Go百科ce, i guess one for the app and one for safari, how do i solve t

My app uses navigator.geolocation provided by PhoneGap. When running the app on iPhone is asks for location permissions twi开发者_Go百科ce, i guess one for the app and one for safari, how do i solve this?


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.


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

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


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消