Reputation: 61
In my app I am asking for microphone permission, and then I check the status by printing it as follows:
var micPermStatus = await Permission.microphone.request();
print(micPermStatus)
However, sometimes the app doesn't pop up the dialog box that asks for permission, and the printed statement says 'PermissionStatus.permanentlyDenied'
I don't understand why it is doing this sometimes. I want it to ask for permission every single time.
What can I do to remedy this?
Thanks.
Upvotes: 0
Views: 480
Reputation: 929
if user denied permanently permission on first time, status will change to permanently denied and you should handle it on your code by asking user and open app setting to change it
this is how it's done with permission_handler package:
if (await Permission.microphone.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();
}
Upvotes: 1