Baseflow / Baseflow/flutter-permission-handler

[Feature request]: [Android] Make it possible to tell if location permission is FINE or COARSE

Open
#1,356 1 comment 9 reactions 1 assignee Claimed by @TimHoogstrate View on GitHub
P2 refactor type: enhancement
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

As of Android 12, the user can decide to give only COARSE location permission, even if the app is asking for FINE. In our app, we really need FINE, COARSE is not enough for our use case, and we would like to be able to show a message to the user that they either need to grant FINE, or the feature will not be available at all.

It seems like this library doesn't support asking which one of the two permissions have been granted as it merges both into one, e.g. `Permission.location` represents both COARSE and FINE. It makes it impossible for us to implement the feature as requested by the customer without writing platform specific code.

### Proposal

I propose that there be a way to ask exactly which location permissions (COARSE or FINE) are granted. 2 ideas:
1. Splitting the current `Permission` that represent both (e.g. `Permission.location`) in 2 separate fields. This is a breaking change.
2. Adding a helper like `AndroidLocationPermission.grantedPermissions` which would return a list with the permissions that are granted by the user. The values would have to be of a different type than `Permission`, e.g. `AndroidLocationPermission.coarse` and `AndroidLocationPermissions.fine`. This would not be a breaking change as the functionality would be completely new and independent of the currently existing code. Not sure what to do for iOS, though, I'm not an iOS user or developer.

### Specific requirements or considerations

_No response_

### Additional information or context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.