Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"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
 }
like image 782
user623396 Avatar asked Sep 19 '25 12:09

user623396


2 Answers

Somehow it got fixed just by doing

cordova plugin rm cordova-plugin-geolocation

and

cordova plugin add cordova-plugin-geolocation
like image 131
user623396 Avatar answered Sep 22 '25 04:09

user623396


Removing and reinstalling the geolocation plugin didn't solve the problem in my case. I had to remove and reinstall the entire android platform from cordova.

cordova platform rm android
cordova platform add android
like image 31
Ahmed Elashker Avatar answered Sep 22 '25 04:09

Ahmed Elashker