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?
You need to do the geolocation after the device is ready. The following Jquery code, for example, will geolocate without that nasty alert:
I'm late to the party here, but will answer the question for reference. The answer is to use the geolocation functions found in phonegap.js which is included with Phonegap. You will be able to find such instructions on the Phonegap site at http://www.phonegap.com.
If you use
navigator.geolocation
, you are using the default Safari geolocation system. This happens as PhoneGap works by running your pages effectively in a Safari instance. If you include phonegap.js into your site, you can use a separate geolocation method exposed by PhoneGap's Objective-C code, which will present the behaviour seen in other apps where it asks for permission from [your app name].I just followed the documentation and solved it. Open the terminal and cd to your project and enter following command. $ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
Also add this in your config.xml
It will solve this issue. :)
Source: http://docs.phonegap.com/en/3.0.0/cordova_geolocation_geolocation.md.html#The%20Command-line%0AInterface
What is the Bundle display name of your project?
Try changing manually from the default value
${PRODUCT_NAME}
and see..That Permission to use location alert picks your bundle display name only!!
To solve the issue I have to run
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
which adds (automatically) to the config.xml the following:To get things working I have to put also this lines into the config.xml:
Hope it could be helpful.
After making sure my
geolocation
request was called after the device was ready, making sure the geolocation plugin is correctly installed and configured, I was still receiving the unsightly popup.I resolved it by moving and referencing my
cordova.js
file andcordova_plugins.js
files into the root directory of my application (they were originally in a subfolder), so the path tocordova.js
would be:I feel this should be included in the documentation (maybe it is, but I haven't managed to find it)