Geolocation
Get the device's GPS position once or stream live location updates.
Get started
Readings are delivered on the location event, so subscribe before you call. Request the location permission first.
Get the current position
Get a single GPS fix. The reading arrives on the location event.
Stream location while the app is open
Start a continuous stream of foreground updates. Each update fires the location event. Call stopForegroundTracking() to end it.
Stop a foreground stream
Stop an active foreground stream.
Keep tracking in the background
Keep receiving location updates while the app is backgrounded. The result fires the backgroundLocationEnabled event with { enabled, alreadyRunning, reason }.
Android only; elsewhere it doesn't run. Check backgroundLocationEnabled (especially reason) to know whether it actually started.
Stop background tracking
Stop background updates. The result fires the backgroundLocationDisabled event with { enabled }. Android only.
Events
All position data arrives on events. bdk.on(...) returns an unsubscribe function.
location— every position reading (one-shot or streamed).backgroundLocationEnabled—{ enabled, alreadyRunning, reason }.backgroundLocationDisabled—{ enabled }.