Hi I am having a problem with geolocation, I tried both the cordova-plugin-geolocation
and the normal navigator.geolocation
. None of them worked. I installed Whitelist and used this Meta tag
<meta http-equiv="Content-Security-Policy" content="default-src *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *">
It didn’t work still. I have set the android permissions
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <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" />
With all my efforts so far, Geolocation is not working. This is how I am using Geolocation with ngCordova
$cordovaGeolocation.getCurrentPosition(posOptions) .then(function (position) { var lat = position.coords.latitude; var long = position.coords.longitude; console.log({lat: lat, long: long}); $scope.$broadcast('isFoundPosition', {lat: lat, lng: long}); // $mdBottomSheet.hide(); }, function (err) { console.log(err); });
When I checked the logs I am getting this error :
11-01 08:59:52.232: E/LocationProvider(8786): Caught security exception while registering for location updates from the system. The application does not have sufficient geolocation permissions.
What am I doing wrong?