New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library returns 'permanentlyDenied' when dialog is dismissed #709
Comments
@mvanbeusekom Is this normal behavior and I should work around it or a bug? |
@DarkMikey sorry I will have to look into this and see how we can catch this specific situation. Unfortunately I didn't find the time yet to do. |
Hi @DarkMikey, I have been debugging this issue a bit and the following is happening when you dismiss the permission dialog (in my case I press the Android back button).
Since the permission dialog is fully controlled by Android (separate intent and activity) we cannot override the back button logic or detect if it is pressed. This means that at the moment I don't see a way around this issue. The only option would be to remove the check on the For now I will close this issue as I don't see how we could solve this. However feel free to post your thoughts on this and if there is something I overlooked I would be more then happy to reconsider and see if we can make a better implementation. |
Thank you that you took the time to look into this. |
@mvanbeusekom is there a way to return information that the dialog was closed without a selection? |
@Nightbl927 not to my knowledge unfortunately. If you know of a way or find something I would be very interested. |
@mvanbeusekom I'll have to take a look at the code to see if I can hack a way to do so. Thanks for your hard work! |
Hi Here is my code: Future<bool> _askLocationPermission() async {
PermissionStatus locationStatus = await Permission.location.status;
if (locationStatus.isDenied) {
locationStatus = await Permission.location.request();
if (locationStatus.isPermanentlyDenied) {
//TODO: How to understand if deny was permanent before last request()?
bool canBeOpened = await openAppSettings();
//State of permission after finishing 'openAppSettings' screen is handled in 'didChangeAppLifecycleState'
return false;
}
}
return locationStatus == PermissionStatus.granted;
} |
Hi @kostadin24, Not sure if I understand correctly, however if there are two situations:
In both situations the In all other cases you are free to request permissions again and Android will show the permission dialog. Note that is you request permissions while the permissions are actually permanently denied, Android will not show a permission dialog to the user and the permission_handler will immediately return with a |
I call openAppSettings when detect permanentDenied. Thanks |
You should test this out carefully, the You could even store this state on the device (e.g. by using the |
@mvanbeusekom I still get
my compileSdkVersion is set to 33 |
Hi @kightsonsanom! This is likely because the latest version of the plugin doesn't include the latest Android update that is mentioned in #1125. I have opened #1150 to bring the app-facing package up-to-date. |
I confirm that it works fine on version 11.0.0, thanks! |
Thanks for confirming! |
馃悰 Bug Report
permission_handler
8.1.6 returnsPermissionStatus.permanentlyDenied
instead ofPermissionStatus.denied
if the dialog is dismissed. This is a contradiction to this statement here: "PermissionStatus.permanentlyDenied
means permissions have been denied and the user should grant permissions through the OS "Settings" (permissions dialogs will not be shown when requesting permission).". Dialogs are shown if I click that again.https://user-images.githubusercontent.com/31889204/137786586-780d8626-4473-4ff7-a3e4-a54318e07e66.mp4
This could lead to a second dialog that points the user to the settings:
https://user-images.githubusercontent.com/31889204/137789474-e026bce9-4a1c-43df-b0c5-3872b23b7f6d.mp4
I've read the following, but I'm unsure how to proceed:
Expected behavior
I guess this should return
PermissionStatus.denied
.Reproduction steps
Status: denied
(freshly initialized)Status: permanentlyDenied
Version: 8.1.6
Platform:
The text was updated successfully, but these errors were encountered: