Navigator.geolocation.getCurrentPosition does not fire in Android 6.0 version


#1

Hey Ionic devs!

I faced recently a very hard issue, spent few days but no success. Getting current position in Android 6.0 is not working. I have tried navigator.geolocation.getCurrentPosition(success, error, options) and $cordovaGeolocation.getCurrentPosition(options).then(success, error) but no options working. It is working in Android 4.x version.

Thanks


#2

Getting the exact same issue here. Two days of troubleshooting, no success. Getting the error “application does not have sufficient geolocation permissions”, even though I’ve included:

<uses-permission android:name=“android.permission.INTERNET” />
<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” />

in the AnodridManifest.xml file


#3

I believe Android 6.0 introduces run-time permissions (rather than install-time) that have to be handled differently.

Have a look at the requestRuntimePermissions function of this plugin: https://github.com/dpa99c/cordova-diagnostic-plugin#requestruntimepermissions