Geolocation: 'app/www/index.html would like to use'

When I try to get the geolocation, I get the alert window that says ‘…app/www/index.html would like to use your current location’ (see attached).

I have the app name properly defined in config.xml. How can I make sure that displays instead of index.html?


Can you share some code how you implemented the geolocation?

I’m using this code and iOS alerts "App Name" Would Like to Use Your Current Location:

navigator.geolocation.getCurrentPosition(function(position) {
    // Success
}, function(error) {
    // Error

The app name is indeed from config.xml.

Could you post your config.xml?


and the permissions for the geolocation should be set.

Greetz, bengtler

Here’s my config.xml:

 <?xml version='1.0' encoding='utf-8'?>
 <widget id="com.madalion.fyied" version="1.0.0" xmlns="" xmlns:cdv="">
  Some descriptiond
<author email="” href="">
  App Development Team
<content src="index.html" />
<access origin="*" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="BackupWebStorage" value="none" />
<feature name="StatusBar">
  <param name="ios-package" value="CDVStatusBar" onload="true" />

Here is the service code I have. The idea is to get a location update at X intervals.
In fact at app launch, I get two alert windows: one with proper app name and the second right after with ‘www/index.html’.

'use strict';

 .factory('GeoLocation', function ($interval, Constants) {
 var coords = null;
 var promise = null;

var options = {
    enableHighAccuracy: true,
    timeout: 5000,
    maximumAge: 0

  function success(pos) {
    coords = pos.coords;

    if (!promise){
       promise = $interval(function(){
          navigator.geolocation.getCurrentPosition(success, error, options); 
        }, Constants.geolocationRefresh);

  function error(err) {
    console.warn('ERROR(' + err.code + '): ' + err.message);
    if (promise) $interval.cancel(promise);
    coords = null;

  navigator.geolocation.getCurrentPosition(success, error, options); 

  return {
     coordinates: function(){
      return coords;

Your config.xml should be good and it looks almost identical to mine. Did you run the app on the simulator or on a device?

I think you need geolocation plugin to get this working :wink:

1 Like

I am testing it on a device

Reinstalling geolocation plugin did the trick. Thanks

1 Like


+1 for this


Can you help me resolve this issue?

you probably didn’t wrap your $cordovaGeolocation function into $ionicPlatform.ready.

here is mine,it works

var located = function() {
  $ionicPlatform.ready(function() {
      enableHighAccuracy: false
    }).then(function(position) {
      function(error) {
          template: error.message,
          duration: 1000

Hi @lcya86

I using code below:

  var watchGeoLocation = $cordovaGeolocation.watchPosition({
      timeout : 5*1000,
      enableHighAccuracy: true // may cause errors if true
  document.addEventListener("deviceready", function () {

      function(err) {
        console.log("Error watch geo location:");
      function(position) {

        var lat  = position.coords.latitude
        var long = position.coords.longitude
  }, false);

and title not good with code

Hi @lcya86

Do you using cordova version ?


my cordova version is 5.1.1 and my plugin is org.apache.cordova.geolocation@0.3.12
Have you ever try to put the $cordovaGeolocation.watchPosition() function into $ionicPlatform.ready()?

the gelocation call should be into the $ionicPlatform.ready()
// get geolocation

the gelocation call should be into the $ionicPlatform.ready()
// get geolocation

Moving up cordova.js in my index.html file fixed the issue.

<script src="cordova.js"></script> should be first js file.