According to the Permissions on Android guide, an app can check for runtime permissions and request permissions if it hasn't been granted already. The following dialog will be displayed when requesting a permission from the user:
In case the user declines the permission request, imo an app should display an explanation why the permission is needed and what impact declining has. That dialog has two options:
- re-try again (permission is requested again)
- deny (app will work without that permission).
If the user checks Never ask again
however, the second dialog with the explanation shouldn't be shown, especially if the user already declined once before.
Now the question is: How does my app know whether the user has checked the Never ask again
? From what I can tell, the onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
method doesn't give me that information.
My second question is: Does Google have plans to incorporate a custom message in the permission dialog that would explain why the app needs the permission? That way there would never be a second dialog which would certainly make for a better user experience.
Developer Preview 2 brings some changes to how permissions are requested by the app (see also http://developer.android.com/preview/support.html#preview2-notes).
The first dialog now looks like this:
There's no "Never show again" check-box (unlike developer preview 1). If the user denies the permission and if the permission is essential for the app it could present another dialog to explain the reason the app asks for that permission, e.g. like this:
If the user declines again the app should either shut down if it absolutely needs that permission or keep running with limited functionality. If the user reconsiders (and selects re-try), the permission is requested again. This time the prompt looks like this:
The second time the "Never ask again" check-box is shown. If the user denies again and the check-box is ticked nothing more should happen. Whether or not the check-box is ticked can be determined by using Activity.shouldShowRequestPermissionRationale(String), e.g. like this:
That's what the Android documentation says (https://developer.android.com/training/permissions/requesting.html):
To know if the user denied with "never ask again" you can check again the shouldShowRequestPermissionRationale method in your onRequestPermissionsResult when the user did not grant the permission.
You can open your app setting with this code:
There is no way of sending the user directly to the Authorization page.