Skip to content
Blog

geolocator in Depth: Permissions, Accuracy and Platform Settings on Android and iOS

How geolocator maps onto six federated packages, the Android precise/approximate grant model, iOS whenInUse authorization, per-platform settings, and LocationAccuracy.

Published on • November 12, 2026

AI Assistant

Our earlier weather app tutorial walked the happy path of geolocator: declare permissions, request them, call getCurrentPosition(). This post goes one level deeper into what actually happens under that API, how the six packages behind it divide the work, and the platform rules that decide whether you get a precise fix, an approximate one, or nothing at all.

One API, six packages

geolocator 14.1.2 (a Flutter Favorite from Baseflow, published October 2026) is a federated plugin. The app-facing package holds the Geolocator facade, while the real work lives in endorsed implementations that pub get pulls in for you:

dependencies:
  geolocator: ^14.1.2

Behind that single line sit geolocator_android (^5.1.0), geolocator_apple (^2.3.14), geolocator_web (^4.1.4), geolocator_linux (^0.2.6), geolocator_windows (^0.2.3) and geolocator_platform_interface (^4.4.0). The platform interface package defines the GeolocatorPlatform contract plus a default method-channel implementation, and each endorsed package overrides it. On Android the calls land on FusedLocationProviderClient (falling back to LocationManager), and on iOS they land on CLLocationManager.

Two practical consequences of that layout: platform-specific settings classes only exist if you import their package, and the README’s own sample currently imports geolocator_web through package:geolocator_android/geolocator_web.dart, which does not resolve, so import each implementation package directly in the file where you build settings.

Android: coarse, fine, and the background trap

Google’s location permissions guide is blunt about the manifest: always declare ACCESS_COARSE_LOCATION, and declare ACCESS_FINE_LOCATION only if your feature genuinely benefits from precision. Since Android 12 (API 31) the user can grant approximate access only, and if they do, your app receives approximate data (roughly 3 square kilometers) no matter which permissions you declared. Precise access, when granted, is usually within about 50 meters.

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Only for features that track the user while backgrounded -->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

Background access is a separate permission on Android 10 (API 29) and higher, and Google Play restricts it to apps whose core features need it. If you run a tracking service while backgrounded, you must also declare android:foregroundServiceType="location" on that service (required from API 29), and the system schedules a reminder notification the first time your app reads location from the background. One newer rule worth knowing: if you target Android 17 (API 37) and only need session-based access, Play policy pushes you toward the system location button instead of a runtime request.

iOS: whenInUse first, always second

On iOS the ordering is mandatory. You call requestWhenInuseauthorization() (available since iOS 8.0) to get whileInUse, and only then can always be requested. Without the usage description key in Info.plist, the system terminates your app the moment the API is called:

<key>NSLocationWhenInUseUsageDescription</key>
<string>Your location is used to show nearby results.</string>

always additionally needs NSLocationAlwaysAndWhenInUseUsageDescription, and on iOS 16 and above the geolocator readme notes you must also declare UIBackgroundModes with a location entry to receive updates in the background. Reviewers scrutinize that combination, so ship whileInUse first and add always only when a feature truly needs it.

One settings object per platform

The LocationSettings base class covers the common cases, but each platform has knobs the others do not. Build the right one at runtime:

import 'package:flutter/foundation.dart';
import 'package:geolocator/geolocator.dart';
import 'package:geolocator_android/geolocator_android.dart';
import 'package:geolocator_apple/geolocator_apple.dart';
import 'package:geolocator_web/geolocator_web.dart';

LocationSettings buildSettings() {
  if (defaultTargetPlatform == TargetPlatform.android) {
    return AndroidSettings(
      accuracy: LocationAccuracy.high,
      distanceFilter: 100,
      intervalDuration: const Duration(seconds: 10),
      foregroundNotificationConfig: const ForegroundNotificationConfig(
        notificationTitle: 'Location active',
        notificationText: 'Updating your position in the background.',
        enableWakeLock: true,
      ),
    );
  }
  if (defaultTargetPlatform == TargetPlatform.iOS ||
      defaultTargetPlatform == TargetPlatform.macOS) {
    return AppleSettings(
      accuracy: LocationAccuracy.high,
      activityType: ActivityType.fitness,
      pauseLocationUpdatesAutomatically: true,
      showBackgroundLocationIndicator: false,
    );
  }
  if (kIsWeb) return WebSettings(accuracy: LocationAccuracy.high);
  return const LocationSettings(accuracy: LocationAccuracy.medium);
}

AndroidSettings.forceLocationManager swaps FusedLocationProvider for the raw LocationManager, which is occasionally useful on emulators without Google Play services. AppleSettings maps onto CLLocationManager behavior: pauseLocationUpdatesAutomatically, activityType, and the background indicator toggle.

Accuracy is a request, not a guarantee

LocationAccuracy translates into platform priorities, and the mapping is not symmetric:

LocationAccuracyAndroid priorityiOS constant
lowestPRIORITY_PASSIVEkCLLocationAccuracyThreeKilometers
lowPRIORITY_LOW_POWERkCLLocationAccuracyKilometer
mediumPRIORITY_BALANCED_POWER_ACCURACYkCLLocationAccuracyHundredMeters
high / best / bestForNavigationPRIORITY_HIGH_ACCURACYkCLLocationAccuracyNearestTenMeters and above

lowest on Android is a passive listener: it only receives fixes computed for other apps, so it may return nothing at all. On iOS, higher accuracy directly increases battery cost, which is why pauseLocationUpdatesAutomatically exists. To learn what the user actually granted, call Geolocator.getLocationAccuracy(): it returns LocationAccuracyStatus.reduced for approximate-only grants and LocationAccuracyStatus.precise otherwise. It throws a PERMISSION_DENIED PlatformException if no permission has been granted yet, and on iOS 14+ it reports reduced before the first grant.

Streams, distance filters, and service status

Continuous tracking goes through getPositionStream, where distanceFilter is the main lever for battery life:

final sub = Geolocator.getPositionStream(
  locationSettings: buildSettings(),
).listen((Position pos) {
  debugPrint('${pos.latitude}, ${pos.longitude}');
});

await sub.cancel(); // stop tracking when the screen closes

distanceFilter is the minimum horizontal movement in meters before a new event fires, and intervalDuration paces Android updates. A timeLimit on the stream raises TimeoutException and cancels it, which is a feature when you want a guaranteed cadence. Pair the stream with Geolocator.getServiceStatusStream() so your UI can react when the user toggles location off mid-session.

Denial paths are UI states, not errors

checkPermission() and requestPermission() return four values, and each one deserves a different screen:

ResultMeaningYour move
deniedInitial state, or user said no this timeExplain the value, then ask again
deniedForeverThe system dialog is suppressedGeolocator.openAppSettings()
whileInUseForeground-only grantEnough for foreground features
alwaysBackground grantOnly after configuring background modes

One asymmetry trips up a lot of Android code: the OS cannot tell you whether a denial is permanent when checking, so deniedForever only appears as the result of requestPermission(). Plan your first-launch flow around that. Also call Geolocator.isLocationServiceEnabled() before promising anything, and route users to Geolocator.openLocationSettings() when the service itself is off. For the browser side of the same API, where none of this settings machinery exists, see our Flutter web geolocation post.

Takeaway: Treat geolocator as six packages behind one facade: declare coarse always and fine only when precision matters, request whileInUse before always, build AndroidSettings/AppleSettings/WebSettings per platform, interpret LocationAccuracy as a priority hint rather than a promise, and give every permission result, including reduced accuracy and deniedForever, its own explicit UI state.

Sources