How to handle "gps" location provider requires ACCESS_FINE_LOCATION permission. in flutter apps


Hi I am trying to get user location by using location package and google-maps-flutter in flutter.. but I get an error that say "gps" location provider requires ACCESS_FINE_LOCATION permission. I have added this code in my androidmanifest file

<uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

I still get an error although I have added that there something that I should do to prevent this problem?


You should check your self permission status and If it did not granted by user, you should request for permission. You could use location plugin for request permissions.

Location location = new Location();

bool _serviceEnabled;
PermissionStatus _permissionGranted;
LocationData _locationData;

_serviceEnabled = await location.serviceEnabled();
if (!_serviceEnabled) {
  _serviceEnabled = await location.requestService();
  if (!_serviceEnabled) {

_permissionGranted = await location.hasPermission();
if (_permissionGranted == PermissionStatus.denied) {
  _permissionGranted = await location.requestPermission();
  if (_permissionGranted != PermissionStatus.granted) {

_locationData = await location.getLocation();

Answered By – Savas Adar

Answer Checked By – Candace Johnson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *