State¶
data classState
Read-only snapshot of the SDK's current runtime state.
val bgGeo = BGGeo.instance
val state = bgGeo.state
Log.d(TAG, "[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.
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.
// If the SDK is currently in the *stationary* state:
val bgGeo = BGGeo.instance
bgGeo.onMotionChange { location ->
Log.d(TAG, "[onMotionChange] isMoving? ${location.isMoving}")
}
bgGeo.changePace(true)
// bgGeo.enabled and motion state 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¶
val trackingMode:TrackingMode
Current tracking mode.
| Value | Mode | Description |
|---|---|---|
0 |
Geofences | Geofence monitoring only — no active location tracking. |
1 |
Location | Location tracking and geofence monitoring. |