flutter-permission-handler
flutter-permission-handler copied to clipboard
Correct doc for permanentlyDenied status
🚀 Feature Requests
permanentlyDenied
maybe on ios in case when user disallow permissions in the OS setting. In this case .request()
open Settings for your app
Contextualize the feature
Describe the feature
Edit doc for permanentlyDenied status in source, remove line /// *Only supported on Android.*
Platforms affected (mark all that apply)
- [x] :iphone: iOS
- [ ] :robot: Android
I got the same problem but the .request()
method is not calling settings automatically.
ok, disregard what is written underneath, it is all described here in the Wiki https://github.com/Baseflow/flutter-permission-handler/wiki/Changes-in-6.0.0#breaking-changes
I would like to suggest adding to docs (in your own words) that it is wrong to expect that a call to Permission.xxxxx.status
will return PermissionStatus.isPermanentlyDenied
after the permission was set to "Don't allow" or permanentlyDenied
. Instead, it returns PermissionStatus.denied
and it is necessary to know if the app is returning from the openAppSettings
call (i.e. Settings screen) to set the permission to what it really is.
Something along these lines:
bool hasOpenedAppSettings = openAppSettings();
// opens Settings or App Settings screen
...
// return to app from Settings screen
var permissionStatus = Permission.xxxxx.status;
if (hasOpenedAppSettings && permissionStatus.isDenied) {
permissionStatus = PermissionStatus.permanentlyDenied;
}
Please correct me if I'm wrong, maybe my approach was wrong from the start. I've lost a great deal of time on the assumption that permanentlyDenied
will be returned and I remembered, way too late, that I read somewhere that this is the case. If I find the source, I will amend it to this comment.
I also found this doc misleading. I read the doc and understood that PermissionStatus.permanentlyDenied
will never happen on iOS.
I am using this library v8.1.6. But, I get status=PermissionStatus.permanentlyDenied
on my iOS 15 device.
I checked iOS code, and found a case when it returns PermissionStatus.permanentlyDenied
.
https://github.com/Baseflow/flutter-permission-handler/blob/634b29bf03faf4431fd4bf535eb03eb0d10a6c53/permission_handler/ios/Classes/strategies/ContactPermissionStrategy.m#L45
Closing, as it seems to be a duplicate of #826.