Baseflow / flutter-permission-handler

Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
https://baseflow.com
MIT License
2.05k stars 859 forks source link

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

Open wujek-srujek opened 3 months ago

wujek-srujek commented 3 months ago

Is there already an issue requesting this feature?

Please select affected platform(s)

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

TimHoogstrate commented 2 months ago

Dear @wujek-srujek,

We're currently in the process of a refactor that will enable this feature. I'll label this as an enhancement for now.

Kind regards,