Problem with geolocation alert

Every time I open the application asks permission with a message “/private/var/mobile/Containers/Bundle/Application/XXXX/XXXXXXX/appname/www/index.html” Would Like To Use Your Current Location.

I need that message CHANGE, you mean like when the camera is used the question is simple without much text does not. And the other thing is I need it 1 time, ie when you first install the application and you, not every time you open it. Check the permissions and tells Location -> When used. And what I need is to tell FOREVER.

I hope you can help me.

I leave the list of plugin that I use and the code (I’m not using a geolocation plugin)

Cordova plugin ls

com.brodysoft.sqlitePlugin 0.7.1 "Cordova sqlite storage"
com.hutchind.cordova.plugins.launcher 0.2.2 "Launcher"
com.ionic.keyboard 1.0.3 "Keyboard"
com.lampa.startapp 0.0.4 "startApp"
com.ohh2ahh.plugins.appavailability 0.3.1 "AppAvailability"
hu.dpal.phonegap.plugins.PinDialog 0.1.2 "PinDialog"
nl.x-services.plugins.toast 2.0.2 "Toast"
org.apache.cordova.camera 0.3.6 "Camera"
org.apache.cordova.console 0.2.11 "Console"
org.apache.cordova.dialogs 0.3.0 "Notification"
org.apache.cordova.file 1.3.3 "File"
org.apache.cordova.inappbrowser 0.5.4-dev "InAppBrowser"
org.apache.cordova.network-information 0.2.15 "Network Information"
org.apache.cordova.splashscreen 0.3.3 "Splashscreen"
org.devgeeks.Canvas2ImagePlugin 0.6.0 "Canvas 2 Image"

Code :

<script type="text/javascript">
  $(function(){
    document.addEventListener("deviceready", onDeviceReady, false);
  })

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

  function onSuccess(position) {
    console.log(position);
  }

  function onError(error) { 
    console.log(error);
  }
</script>

Controller :

if (navigator.geolocation) {
      navigator.geolocation.getCurrentPosition(function (position) {
          latitud_actual = position.coords.latitude; 
          longitud_actual = position.coords.longitude;
          console.log(latitud_actual);
          console.log(longitud_actual);
          var mapOptions = {
              center: new google.maps.LatLng(latitud_actual, longitud_actual),
              zoom: 15,
              mapTypeId: google.maps.MapTypeId.ROADMAP,
              scrollwheel: false
          };
          map = new google.maps.Map(document.getElementById("mapa_ubicacion"), mapOptions);
          $scope.setMarker(map, new google.maps.LatLng(latitud_actual, longitud_actual), 'Yo', '');
      });
  }

thanks

I have the same problem with my app.

It appeared a few day ago when I have reinstalled my environment.

I still can not get around this, you do not know any solution :(?

Not for the moment but I am investigating on it.

The problem is that you’re using the BROWSER’s geolocation capability. By default, iOS asks this every X hours or something like that when accessing the geolocation in a browser.

Instead, you need to use the native Geolocation service in your app. So, you need to install the geolocation Cordova plugin. https://github.com/apache/cordova-plugin-geolocation/ Then, after the user gives permission for the app, it will never ask again.

It would be even better if you used ngCordova for this. http://ngcordova.com/docs/plugins/geolocation/

2 Likes

when I try to install the plugin, I had several problems, which I spent more is that, for example, in a view have a list of places. When you click on an item opens a detail and carried well Map 1, but other details loading the map no longer appeared and did not launch any kind of error. I imagine that the error was mine, for some parameter code or missing me.

** BUILD FAILED **

The following build commands failed:
CompileC build/view_ios.build/Debug-iphonesimulator/view_ios.build/Objects-normal/i386/CDVLocation-ED0BB026C0CCE47C.o view_ios/Plugins/cordova-plugin-geolocation/CDVLocation.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Having the same problem. Any fix?

Same problem. Can anyone issue some fixes?

I’m facing the same problem, and I have ngCordova + cordova-plugin-geolocation in use. iOS asks permission to access location info repeatedly even though the user has accepted this permission request. Sometimes it asks is, sometimes not.

@Erkkimon have you found a solution for the problem of geolocation permission ?

I still see this issue. Here is my entry in the forum.

Hi! I have the same issue!
Anyone have any fix?
Tnx!