State¶
public structState
Read-only snapshot of the SDK's current runtime state.
let bgGeo = BGGeo.shared
let state = bgGeo.state
print("[state] enabled:", state.enabled, "trackingMode:", state.trackingMode)
Properties¶
| Property | Type | Description |
|---|---|---|
| enabled | Boolean | Whether the SDK is currently tracking. |
| isMoving | Boolean | Whether the device is currently in motion. |
| trackingMode | TrackingMode | Current tracking mode: LOCATION or GEOFENCE. |
| odometer | Double | Distance travelled in metres since last reset. |
| schedulerEnabled | Boolean | Whether the scheduler is currently active. |
| didDeviceReboot | Boolean | Whether the device rebooted since the SDK was last running. |
Members¶
didDeviceReboot¶
true when the app was launched after a device reboot.
didLaunchInBackground¶
iOS only true when the app was relaunched in the background by the OS — for
example, due to a background fetch, geofence exit, or stationary geofence
transition. On Android, background launch is handled by the Headless Task mechanism —
this property does not apply.
enabled¶
true when the SDK is actively tracking — i.e. BGGeo.start
or BGGeo.startGeofences has been called and not yet stopped.
isFirstBoot¶
true on the very first launch after the app is installed.
isMoving¶
true when the SDK is in the moving state (location services active);
false when stationary.
let bgGeo = BGGeo.shared
// If the SDK is currently in the *stationary* state:
let sub = bgGeo.onMotionChange { location in
print("[onMotionChange] isMoving? \(location.isMoving)")
}
bgGeo.changePace(true)
// config.isMoving is now true.
odometer¶
Accumulated distance traveled since the last odometer reset, in meters.
See also
- odometerError
- BGGeo.setOdometer
- BGGeo.getOdometer
odometerError¶
Accumulated positional error in the odometer measurement, in meters.
Reflects noise introduced by low-accuracy location samples. Use LocationFilterConfig.odometerAccuracyThreshold to filter out low-accuracy samples from odometer calculations.
schedulerEnabled¶
true when a AppConfig.schedule is configured and
BGGeo.startSchedule has been called.
BGGeo.stopSchedule sets this to false.
trackingMode¶
public let trackingMode:TrackingMode
Current tracking mode.
| Value | Mode | Description |
|---|---|---|
0 |
Geofences | Geofence monitoring only — no active location tracking. |
1 |
Location | Location tracking and geofence monitoring. |