How to distinguish "Never ask again" state and "Canceled" state for Android runtime permission?

Viewed 94

User can cancel a permission request by hitting the "Back" button. And since Android 11, user can also clicking on the outside of the permission dialog to cancel. When a permission is canceled, the permission is not granted, and shouldShowPermissionRationale() will return false, which means app can call requestPermissions() again.

When user choose "Don't ask again", or deny twice for a permission in Android 11, shouldShowPermissionRationale() will also return false. But how can I distinguish "Don't ask again" from the "Canceled" state?

I need to distinguish these two states is because that if user canceled a permission before, I know that I still have the chance to prompt the system permission dialog to them. But if user choose not to ask for a permission again, I need to guide them to the app info page to grant the permission manually.

0 Answers
Related