Location error on Android 6 using cordovaGeolocation

I have this app that uses cordovaGeolocation. It works just fine on Android 5 and below, but on Android 6, I get this

“Caught security exception while registering for location updates from the system. The application does not have sufficient geolocation permissions.”

I have set up all the permissions in the AndroidManifest.xml

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />

and my target SDK is 23.

The error is actually similar to what’s described here.

Is this a known problem with Android 6? Do I have to set something else up for cordovaGeolocation to work?


1 Like

Did you fix the issue? I ran into the same one and don’t know, what causes the error.

Hi, yes.

On Android 6, you need to explicitly ask the user for this permission. Just setting them in the AndroidManifest is not enough.

So what I did was to use cordova.plugins.diagnostic.requestLocationAuthorization to request explicit authorization in my app.js.

          console.log("Location is " + (enabled ? "enabled" : "disabled"));
                console.log("Authorization status is now: "+status);
            }, function(error){
      }, function(error){
          console.error("The following error occurred: "+error);

Hope it helps.

1 Like

Android asks me for the permission, with and without the diagnostic plugin. When I grant permission I see this:

5 972446 log Location is disabled
6 972468 log Authorization status is now: GRANTED

But the problem is, that geolocation runs into timeout. I set the value to 60000, so 60 seconds but still getting a geolocation timeout. Do you have an idea if I miss something here?

Thanks a lot!

Looks like a hardware issue to me. My original problem was that the app was crashing because of the permissions.

I will further investigate the issue. Other apps that are using the geolocation service are working fine. Thanks so far!


Did you manage to solve this issue?
I’m having a similar one. cordova geolocation plugin always returns timeout on Android 6 device.


Nope, unfortunately not. I think there are some devices out there, where the Cordova geolocation plugin not works. It would be great if this get fixed some day.

Thanks a lot for the super fast answer. :slight_smile:
Do you know any alternatives to this plugin?

Thanks again!

No, sorry. I tried anything I found in the Internet but there was no solution for me. I used the Ionic creator. Maybe you could try the new Ionic Native APIs for Ionic 2.0 https://ionicframework.com/docs/v2/native/

Did you try this?

No, because the app is in Ionic 1. :frowning:
Thanks anyway.

I tried it with Ionic 2 and the Ionic Native Lib. Same problem. Getting a timeout on my Honor 6 device (Android 6.0)

It’s strange no one else is complaining about this. :frowning:
I don’t find any alternative to this plugin.

Indeed, yes! In my opinion there is no solution because it’s a Cordova issue. I’m playing around with appcelerator currently. It uses Titanium, that is a different technology. I do like Ionic really much, but in this state it won’t work for me :frowning:

Agree with you.
I’ll have have to drop Ionic too. For an issue that’s not even their fault. :confused:
It’s time to test Xamarin! :slight_smile:

hi everyone the solution is very simple upgrade the plugin to version 2 and everything will work on
cordova plugin rm cordova-plugin-geolocation
cordova plugin add cordova-plugin-geolocation
Thats all you need to do. :slight_smile:

1 Like

Sorry reviloera,

What do you mean by version 2? I’me using version 2.4.0 since it was released on September, and the problem persists.


I had the same issue and when I removed and re-installed the plugin , the
problem was solved.

1 Like

What reviloera suggested also worked for me, simply running

ionic plugin add cordova-plugin-geolocation --save

Solved the problem for me on Android 6. Now the app asks for geolocation permission after launch.

1 Like

I have this issue and have reinstalled the plugin tried everything But I still get the error “application does not have sufficient geolocation permissions.” Is there anyone sample code for ionic 3 I can check use?