Skip to content

Platform GPS Requests

The base GpsRequest provides cross-platform defaults, but each platform offers extended request types with additional configuration. Use AndroidGpsRequest or AppleGpsRequest to fine-tune GPS behavior for each platform.

If you pass a base GpsRequest, sensible platform defaults are applied automatically.

PropertyTypeDefaultDescription
BackgroundModeGpsBackgroundModeNoneControls background location behavior
RequestPreciseAccuracyboolfalseRequest precise GPS accuracy
ValueiOSAndroid
NoneForeground onlyForeground only
StandardSignificant location changesBackground updates (~3-4 per hour)
RealtimeFull background (every ~1 second)Foreground service (every ~1 second)
GpsRequest.Foreground // No background, no precise accuracy
GpsRequest.Background // Standard background mode
GpsRequest.Realtime(precise) // Realtime with optional precise accuracy

Extends GpsRequest with Android-specific settings from the Fused Location Provider.

await gpsManager.StartListener(new AndroidGpsRequest(
BackgroundMode: GpsBackgroundMode.Realtime,
GpsPriority: GpsPriority.HighAccuracy,
IntervalMillis: 5000,
DistanceFilterMeters: 10,
WaitForAccurateLocation: true,
StopForegroundServiceWithTask: false,
RequestPreciseAccuracy: true
));
PropertyTypeDefaultDescription
BackgroundModeGpsBackgroundModeNoneBackground behavior
GpsPriorityGpsPriorityBalancedLocation accuracy/power trade-off
DistanceFilterMetersdouble0Minimum distance change (meters) to trigger an update
IntervalMillisint1000Requested update interval in milliseconds
WaitForAccurateLocationboolfalseWait for an accurate fix before first update
StopForegroundServiceWithTaskboolfalseShut down foreground service when app is swiped away
RequestPreciseAccuracyboolfalseRequest precise GPS accuracy
ValueDescription
HighAccuracyBest accuracy, highest power consumption
BalancedBalance between accuracy and power
LowPowerCoarse accuracy, lower power
PassiveOnly receive updates from other apps’ location requests

Extends GpsRequest with iOS/macOS-specific settings from CLLocationManager.

await gpsManager.StartListener(new AppleGpsRequest(
BackgroundMode: GpsBackgroundMode.Realtime,
DistanceFilterMeters: 50,
ShowsBackgroundLocationIndicator: true,
PausesLocationUpdatesAutomatically: false,
ActivityType: CLActivityType.Fitness
));
PropertyTypeDefaultDescription
BackgroundModeGpsBackgroundModeNoneBackground behavior
DistanceFilterMetersdouble0Minimum distance change (meters) to trigger an update
ShowsBackgroundLocationIndicatorbooltrueShow the blue status bar indicator during background tracking
PausesLocationUpdatesAutomaticallyboolfalseLet iOS pause updates when location isn’t changing significantly
UseSignificantLocationChangesboolfalseUse significant location change monitoring (lower power, less frequent)
ActivityTypeCLActivityTypeOtherHint to iOS about the type of activity for optimization
ValueDescription
OtherGeneral purpose
AutomotiveNavigationDriving navigation
FitnessWalking, running, cycling
OtherNavigationNon-automotive navigation (boats, trains)
AirborneFlight tracking

On non-matching platforms, platform-specific requests are automatically converted. You can safely pass an AndroidGpsRequest on iOS — only the base GpsRequest properties will be used.

// Platform-specific setup with #if directives
#if ANDROID
var request = new AndroidGpsRequest(
BackgroundMode: GpsBackgroundMode.Realtime,
GpsPriority: GpsPriority.HighAccuracy,
IntervalMillis: 2000
);
#elif IOS
var request = new AppleGpsRequest(
BackgroundMode: GpsBackgroundMode.Realtime,
ActivityType: CLActivityType.Fitness
);
#else
var request = GpsRequest.Foreground;
#endif
await gpsManager.StartListener(request);