Baseflow / Baseflow/flutter-permission-handler
[Feature request]: Support for PERMISSION_DENIED_APP_OP state
- Dominant language
- Dart
- Stars
- 2.2k
- Forks
- 970
- Avg merge
- 14h 22m
- Merged PRs (30d)
- 2
Description
### Is there already an issue requesting this feature?
- [x] I have searched the [existing issues](https://github.com/baseflow/flutter-permission-handler/issues).
### Please select affected platform(s)
- [x] Android
- [ ] iOS
- [ ] Windows
### Use case
On some devices (have seen it on Samsung and some Xiaomi), there are permissions which even if granted by the user may be denied by the OS. An example of this is location permissions. I'm currently working with BLE and noticed that in Samsung location sensor had to be enabled on top of granting the corresponding permissions. Upon further inspection and debugging with Android's `PermissionChecker.checkSelfPermission` I noticed I was getting `PERMISSION_DENIED_APP_OP` (https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/permission/Permissions.md#checking-a-runtime-permission).
Modeling this state would be useful since it allows conditional prompting to the user. For this specific scenario it allows behavior to split between a granted permission and a granted permission with OS restrictions.
### Proposal
I've been looking at the code and found this to be the current set of states https://github.com/Baseflow/flutter-permission-handler/blob/main/permission_handler_android/android/src/main/java/com/baseflow/permissionhandler/PermissionConstants.java#L109. It is kind of unfortunate that this is an android specific behavior - but still it might make sense adding a new state, `PERMISSION_STATUS_OS_DENIED` or similar.
### Specific requirements or considerations
_No response_
### Additional information or context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.