Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

geolocation confirm box showing my index file url in phonegap ios application

I'm creating an ios app with phonegap 3.2 I need users current location to search nearby users. When i tried to get current location of device with code

function onSuccess(position) {
    device_lat = position.coords.latitude;
    device_long = position.coords.longitude;
}

// onError Callback receives a PositionError object

function onError(error) {
    alert("Share Your Location First.");
}

function onDeviceReady()
{
    navigator.geolocation.getCurrentPosition(onSuccess, onError);
}

A confirm box appearing with following text. "/Users/../Library/Application Support/iPhone Simulators/6.1/Applications/[App Code here]/demo.app/www/index.html" Would Like To Use Your Current Location.

Is it possible to costomise this text as its say Like "MyApp Would Like To Use Your Current Location" ?

Also for android and other devices.

like image 781
Avi Avatar asked Nov 11 '22 17:11

Avi


1 Answers

I'm posting a new answer since the last one was incomplete. In order to get the geolocation prompt title to show your app name and not the full path to the file you'll need to do two things:

  1. Install the Cordova / PhoneGap geoLocation pluin (cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git)

  2. Run the getCurrentPosition after deviceready has been fired.

like image 187
Eirik Hoem Avatar answered Nov 15 '22 07:11

Eirik Hoem