Android. Requesting runtime permissions does not work correctly

345 Views Asked by At

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(

0

There are 0 best solutions below