Reputation: 388
I am developing an Ionic application on an Android phone with version 6.0.1, and I am encountering an issue about the geolocation permission.
Solution:
Upvotes: 0
Views: 3649
Reputation: 30356
The app successfully asked user for geolocation permission, but when user clicks NEVER in the dialog, the app fails to ask again.
This is the intended behaviour on Android 6.0: once a user has permanently denied permission by checking the "Never ask again" box, the app is not allowed to programatically prompt the user with a dialog.
The only option is to instruct the user how to manually allow the permissions via the Settings page. To assist with this you can use switchToSettings()
from cordova-diagnostic-plugin to switch the user to your app's settings page.
After the user clicking NEVER, the geolocation premission for our app in the Android App permissions is still enabled. (toggling that doesn't help)
This should not be the case: manually allowing the permission via the app settings page will allow the app to use that functionality. You can confirm this for yourself using the Android permissions example app for cordova-diagnostic-plugin. However, it depends how the plugin you are using to handle the permission requests responds to the "never ask again" situation. It maybe that you need to use cordova-diagnostic-plugin to manually check the permission status and switch to the app settings page if it's DENIED_ALWAYS.
Upvotes: 4