1 Reply Latest reply on Feb 9, 2018 5:17 PM by porterdude

    PhoneGap geolocation is not asking for permissions

    IsaacMellor Level 1



      I am trying to get the cordova-geolocation plugin to give me the current location using getCurrentPosition. However all I receive is the error message "Application does not have sufficient geolocation permissions".


      I am testing Android 7.0 Nougat.


      I have also tried using the Cordova-plugins-diagnostic plugin to ask for the permission runtime but this is not working either.


      This is my config.xml (minus sensitive stuff


      <access origin="*" />
      <access origin="*://*.googleapis.com/*" subdomains="true" />
      <access origin="*://*.gstatic.com/*" subdomains="true" />
      <access origin="*://*.google.com/*" subdomains="true" />
      <access origin="*://*.googleusercontent.com/*" subdomains="true" />

      <allow-intent href="http://*/*" />
      <allow-intent href="https://*/*" />
      <allow-intent href="tel:*" />
      <allow-intent href="sms:*" />
      <allow-intent href="mailto:*" />
      <allow-intent href="geo:*" />

      <platform name="android">
        <allow-intent href="market:*" />

      <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />

      <preference name="Orientation" value="portrait" />
      <preference name="android-targetSdkVersion" value="27" />

      <plugin name="cordova-plugin-geolocation" spec="4.0.1" />
      <plugin name="cordova-plugin-whitelist" spec="1.3.3" />
      <plugin name="cordova-plugin-android-permissions" />
      <plugin name="cordova-custom-config" />
      <plugin name="cordova.plugins.diagnostic" />

      <platform name="android">
        <config-file target="AndroidManifest.xml" parent="/manifest">
        <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 here is the code I am running to get the current location (The function is run on deviceready):


      function getPosition(){






         alert(position.coords.latitude, position.coords.longitude);
         }, function(error){

         alert("Something went wrong while retrieving your position. " + error.message);

         enableHighAccuracy: true




         alert("The following error occurred: " + error.message);


      Any help would be greatly appreciated. I am absolutely stumped and have tried everything I can find everywhere else.



        • 1. Re: PhoneGap geolocation is not asking for permissions
          porterdude Level 1

          I had the same issue.  Tried numerous things others suggested and finally found something that worked.  I use the following plugin name in the config.xml file


          <plugin name="cordova-plugin-geolocation" version="2.1.0" />


          ...and I didn't use any of the android location permissions and for some reason it's working fine now.


          Hope that's helpful.

          1 person found this helpful