flutter-geolocator icon indicating copy to clipboard operation
flutter-geolocator copied to clipboard

Android requires use of both `ACCESS_COARSE_LOCATION` and `ACCESS_FINE_LOCATION` permissions

Open moneytoo opened this issue 2 years ago • 1 comments

🏗 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_LOCATION or the ACCESS_FINE_LOCATION permission 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

moneytoo avatar Jan 23 '23 15:01 moneytoo

Thanks for your input @moneytoo,

I'll label this issue as an enhancement.

TimHoogstrate avatar Jul 21 '23 12:07 TimHoogstrate