Location permission alert on iPhone with PhoneGap

2019-01-03 14:07发布

How do you change the string on the alert saying:

(Appname/whatever it is) would like to use your current location

Of course, I only want to change the appname part. Because when you use the PhoneGap framework, the string is very ugly, something like this:

/var/mobile/Applications/157EB70D-4AA7-826E-690F0CBE0F/appname.app/www/index.html

Someone having an idea?

19条回答
劳资没心,怎么记你
2楼-- · 2019-01-03 15:01

1) modify Location.m in PhoneGapLib project. replace all references of navigator.geolocation with navigator_geo

2) Copy phonegap.js to phonegap2.js and put in root of app. I have now learned that every time I build my application and load it onto device or simulator, the phonegap.js file is being regenerated. OK. Well I need to modify it so lets just use another one and deal with the hassles of upgrading in the future.

3) Modify the line (in phonegap2.js) that creates the constructor for the navigator.geolocation on 626 to be ... if (typeof navigator._geo == "undefined") navigator._geo = new Geolocation();

4) Now in your HTML whenever you want to use the PHONEGAP GPS stuff, you can reference it with navigator._geo.getCurrentPosition or similar 5) Enjoy the ONE, and CLEAN, location alert permission without revealing to your users your intelligence to use PhoneGap and build an app with HTML/JS.

* CAVEAT AND PLEASE HELP! *

If I run the watchPosition function, I will get the first location update with all sorts of stats. There after, It will always report an error. I assume this sucks for this 30 second time of getting accurate GPS on these things?

http://groups.google.com/group/phonegap/browse_thread/thread/8067c2037816a9ad

查看更多
登录 后发表回答