0

I'm use ActivityResultContracts to request runtime permissions. Here is my code:

private val contactsPermissionLauncher =
    registerForActivityResult(ActivityResultContracts.RequestPermission()) { granted ->
        // some logic here
    }

And in onCreate():

contactsPermissionLauncher.launch(Manifest.permission.READ_CONTACTS)

Accordingly, I should be request for permission every time I go to the activity/fragment.

At first glance, everything works well. However, I noticed such a problem, on Android 11, after a certain number of times the permission was denied, when re-navigating to the screen, permission is not requested (that is, the system dialog is not displayed).

And also on android 6, it was noticed that after a lot of permission denial, after the next display of the system dialog asking for permission, when trying to allow, the button does not respond, while the deny button works correctly.

Can you please tell me what could be causing these problems? Perhaps there is a permission request limit?

Please, help me(

testivanivan
  • 967
  • 13
  • 36
  • 1
    "I noticed such a problem, on Android 11, after a certain number of times the permission was denied, when re-navigating to the screen, permission is not requested (that is, the system dialog is not displayed)" -- correct. That is how Android 11 and higher work. – CommonsWare Jul 28 '22 at 12:40
  • 1
    From the [docs](https://developer.android.com/training/permissions/requesting#handle-denial) - "Starting in Android 11 (API level 30), if the user taps Deny for a specific permission more than once during your app's lifetime of installation on a device, the user doesn't see the system permissions dialog if your app requests that permission again.". They would have to go to the Android settings to enable that permission. – Tyler V Jul 28 '22 at 12:42

0 Answers0