4

Using https://pub.dev/packages/permission_handler to get permissions

but it won't ask the user again if user denied permission.

currently checked it on android (iOS device is not available)

Pls Help

Saurabh D Vyas
  • 143
  • 1
  • 1
  • 7
  • Android itself blocks it after 2 times refusing. I don't know if it's that you're experiencing, or that it already stops after 1 time asking. – Ivo Feb 25 '22 at 09:39
  • from [here](https://developer.android.com/about/versions/11/privacy/permissions) "Starting in Android 11, 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." – Ivo Feb 25 '22 at 09:41

2 Answers2

7

If a user has already denied, only thing could be done is to redirect the user to application settings to enable needed permissions.

if (await Permission.speech.isPermanentlyDenied) {
  // The user opted to never again see the permission request dialog for this
  // app. The only way to change the permission's status now is to let the
  // user manually enable it in the system settings.
  openAppSettings();
}
user18309290
  • 5,777
  • 2
  • 4
  • 22
  • 3
    isPermanentlyDenied is returned only as result of request(). If just check for permission status - it says Denied. – Kostadin Aug 02 '22 at 17:37
0

As i understood you want to continuously ask user for permission if it is denied. You can implement something like this to continuously ask for the request unless you get something other than denied :

 Future<bool> askPermission() async{
    PermissionStatus status = await Permission.contacts.request();
    if(status.isDenied == true)
      {
        askPermission();
      }
    else
      {
        return true;
      }
  }

Call this type of method wherever you are requesting for the permission.

akdev
  • 54
  • 5