Search code examples
androidcordovageolocationngcordova

"Illegal Access" on $cordovaGeolocation.getCurrentPosition


Using the cordova-plugin-geolocation I'm getting this error on Android:

PositionError {code: 1, message: "Illegal Access"}

I checked the plugins/android.json file and the permissions are present

{
  "xml": "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />",
  "count": 1
},
{
  "xml": "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />",
  "count": 1
 }

Solution

  • Somehow it got fixed just by doing

    cordova plugin rm cordova-plugin-geolocation
    

    and

    cordova plugin add cordova-plugin-geolocation