Welcome to our documentation!
Platform GPS Requests
Overview
Section titled “Overview”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.
GpsRequest (Base)
Section titled “GpsRequest (Base)”| Property | Type | Default | Description |
|---|---|---|---|
BackgroundMode | GpsBackgroundMode | None | Controls background location behavior |
RequestPreciseAccuracy | bool | false | Request precise GPS accuracy |
GpsBackgroundMode
Section titled “GpsBackgroundMode”| Value | iOS | Android |
|---|---|---|
None | Foreground only | Foreground only |
Standard | Significant location changes | Background updates (~3-4 per hour) |
Realtime | Full background (every ~1 second) | Foreground service (every ~1 second) |
Factory Methods
Section titled “Factory Methods”GpsRequest.Foreground // No background, no precise accuracyGpsRequest.Background // Standard background modeGpsRequest.Realtime(precise) // Realtime with optional precise accuracyAndroidGpsRequest
Section titled “AndroidGpsRequest”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));Properties
Section titled “Properties”| Property | Type | Default | Description |
|---|---|---|---|
BackgroundMode | GpsBackgroundMode | None | Background behavior |
GpsPriority | GpsPriority | Balanced | Location accuracy/power trade-off |
DistanceFilterMeters | double | 0 | Minimum distance change (meters) to trigger an update |
IntervalMillis | int | 1000 | Requested update interval in milliseconds |
WaitForAccurateLocation | bool | false | Wait for an accurate fix before first update |
StopForegroundServiceWithTask | bool | false | Shut down foreground service when app is swiped away |
RequestPreciseAccuracy | bool | false | Request precise GPS accuracy |
GpsPriority
Section titled “GpsPriority”| Value | Description |
|---|---|
HighAccuracy | Best accuracy, highest power consumption |
Balanced | Balance between accuracy and power |
LowPower | Coarse accuracy, lower power |
Passive | Only receive updates from other apps’ location requests |
AppleGpsRequest
Section titled “AppleGpsRequest”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));Properties
Section titled “Properties”| Property | Type | Default | Description |
|---|---|---|---|
BackgroundMode | GpsBackgroundMode | None | Background behavior |
DistanceFilterMeters | double | 0 | Minimum distance change (meters) to trigger an update |
ShowsBackgroundLocationIndicator | bool | true | Show the blue status bar indicator during background tracking |
PausesLocationUpdatesAutomatically | bool | false | Let iOS pause updates when location isn’t changing significantly |
UseSignificantLocationChanges | bool | false | Use significant location change monitoring (lower power, less frequent) |
ActivityType | CLActivityType | Other | Hint to iOS about the type of activity for optimization |
CLActivityType
Section titled “CLActivityType”| Value | Description |
|---|---|
Other | General purpose |
AutomotiveNavigation | Driving navigation |
Fitness | Walking, running, cycling |
OtherNavigation | Non-automotive navigation (boats, trains) |
Airborne | Flight tracking |
Cross-Platform Usage
Section titled “Cross-Platform Usage”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 ANDROIDvar request = new AndroidGpsRequest( BackgroundMode: GpsBackgroundMode.Realtime, GpsPriority: GpsPriority.HighAccuracy, IntervalMillis: 2000);#elif IOSvar request = new AppleGpsRequest( BackgroundMode: GpsBackgroundMode.Realtime, ActivityType: CLActivityType.Fitness);#elsevar request = GpsRequest.Foreground;#endif
await gpsManager.StartListener(request);