flutter-geolocator
flutter-geolocator copied to clipboard
Android requires use of both `ACCESS_COARSE_LOCATION` and `ACCESS_FINE_LOCATION` permissions
🏗 Enhancement Proposal
At https://github.com/Baseflow/flutter-geolocator/blob/geolocator_v9.0.2/geolocator/README.md?plain=1#L58 Geolocator tells devs to inlude either (OR) permission:
On Android you'll need to add either the
ACCESS_COARSE_LOCATIONor theACCESS_FINE_LOCATIONpermission to your Android Manifest.
However when devs want the fine location, they should declare BOTH permissions:
See https://developers.google.com/maps/documentation/android-sdk/location
However, if precise location is needed, then add both ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION permissions to your app's manifest file
Note: On Android 12 (API level 31) or higher, users can request that your app retrieve only approximate location information even when your app requests the ACCESS_FINE_LOCATION runtime permission. To handle this, both ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION permissions should be requested in a single runtime request.
https://developer.android.com/training/location/permissions#approximate-request https://developer.android.com/training/location/permissions#user-choice-affects-permission-grants
To handle this potential user behavior, don't request the ACCESS_FINE_LOCATION permission by itself. Instead, request both the ACCESS_FINE_LOCATION permission and the ACCESS_COARSE_LOCATION permission in a single runtime request.
https://developer.android.com/training/location/permissions#foreground
<manifest ... >
<!-- Always include this permission -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- Include only if your app benefits from precise location access. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
</manifest>
etc.
Pitch
🤷
Platforms affected
- [ ] :iphone: iOS
- [x] :robot: Android
Thanks for your input @moneytoo,
I'll label this issue as an enhancement.