Detecting wether a permission can be requested or is permanently denied

Is there any way of detecting, whether a permission is denied but can still be requested or if it is permanently denied?

Unfortunately there is no official API available to detect if permission is permanently denied when user selects "Never ask again"

There is one work around which uses shouldShowRequestPermissionRationale. Create a SharedPreference with default value false and store value returned by shouldShowRequestPermissionRationale in it. Before updating the value, check if the value set was true. If it was true then don't update it.

Whenever you want to check for permission, get the value from SharedPreference and current value returned by shouldShowRequestPermissionRationale. If shouldShowRequestPermissionRationale returns false but value from SharedPreference is true, you can deduce that Never ask again was selected by user.

You can refer to my blog where I have described this approach.


shouldShowRequestPermissionRationale returns true or false based on the user preference in previous permission request.

If user just denied permission(not forever) shouldShowRequestPermissionRationale will return true. If denied permission for ever, then returns false. And the trick is that, even the user allowed permission then then shouldShowRequestPermissionRationale will return false.

So we can combine both the conditions to get the never ask again chosen or not.

So if user not allowed permission and shouldShowRequestPermissionRationale returns false then it means user opt for never ask again for the permission.