Constants
Every constant is a Kotlin enum with a value (or wire) property carrying
the number or string the engine actually exchanges. Config takes the raw
value, so pass DesiredAccuracy.HIGH.value rather than the enum itself.
Desired accuracy
Config(desiredAccuracy = DesiredAccuracy.HIGH.value)| Constant | Value | Meaning |
|---|---|---|
NAVIGATION | -2 | Highest precision; only for turn-by-turn. Heaviest battery cost. |
HIGH | -1 | GPS-grade. The default, and what tracking is tuned for. |
MEDIUM | 10 | ~10 m; balanced provider, GPS may not engage. |
LOW | 100 | ~100 m; network/cell-grade. |
VERY_LOW | 1000 | ~1 km. |
LOWEST | 3000 | ~3 km. Effectively “which city”. |
The accuracy filter rejects fixes worse than locationFilterMaxAccuracy
(100 m by default), so setting LOW or coarser while that gate is at its
default produces a stream that is mostly rejected. Change both or neither.
Log level
Config(logLevel = LogLevel.INFO.value)| Constant | Value |
|---|---|
OFF | 0 |
ERROR | 1 |
WARNING | 2 |
INFO | 3 |
DEBUG | 4 |
VERBOSE | 5 |
This controls persistence only: the engine always mirrors its lines to
logcat. The level decides what is written to the on-device log database that
getLog() reads and uploadLog() ships. See
Logging & debugging.
Authorization status
Returned by requestPermission() and carried in getState().authorization.
| Constant | Value | Meaning |
|---|---|---|
NOT_DETERMINED | 0 | Nothing asked yet. |
RESTRICTED | 1 | Blocked by policy (device management). |
DENIED | 2 | Refused; no location. |
ALWAYS | 3 | Background location granted. |
WHEN_IN_USE | 4 | Foreground only. |
Accuracy authorization
| Constant | Value | Meaning |
|---|---|---|
FULL | 0 | Precise location. |
REDUCED | 1 | The user granted approximate location only (API 31+). |
Reported by getProviderState(). Approximate location is a coarse grid — with
it, most fixes fail the accuracy gate and tracking is effectively unusable, so
it is worth surfacing to the user rather than debugging as a bug.
Activity types
The classification behind the motion state machine, on
onMotionChange and location.activity.type.
| Constant | Wire value |
|---|---|
STILL | still |
ON_FOOT | on_foot |
WALKING | walking |
RUNNING | running |
ON_BICYCLE | on_bicycle |
IN_VEHICLE | in_vehicle |
UNKNOWN | unknown |
ActivityType.from(wire) maps a raw string back, falling back to UNKNOWN
for anything unrecognised rather than throwing — a new activity class from a
future Play Services release degrades instead of crashing.
License codes
BGeoException is a sealed class; code is the string the engine sent.
| Code | Type | When |
|---|---|---|
LICENSE_MISSING | BGeoException.LicenseMissing | Release build, no key in the manifest |
LICENSE_INVALID | BGeoException.LicenseInvalid | Bad signature or malformed token |
LICENSE_EXPIRED | BGeoException.LicenseExpired | Key expired before this SDK build |
LICENSE_APP_MISMATCH | BGeoException.LicenseAppMismatch | Key not bound to this application id / certificate |
DISABLED | BGeoException.Disabled | Operation needs tracking to be running |
NOT_FOUND | BGeoException.NotFound | No such record (e.g. destroyLocation with an unknown uuid) |
INVALID_GEOFENCE | BGeoException.InvalidGeofence | Geofence rejected: missing identifier, non-positive radius, bad coordinates |
| (anything else) | BGeoException.Unknown | A code this SDK version does not know; code carries it verbatim |
Unknown exists on purpose: an engine that grows a new code stays diagnosable
instead of having it swallowed into a generic failure.
try { BackgroundGeolocation.start()} catch (e: BGeoException) { when (e) { is BGeoException.LicenseExpired -> showRenewalPrompt() else -> Log.e("BGeo", "${e.code}: ${e.message}") }}The same hierarchy arrives through
onLocationError, so a rejected
getCurrentPosition() and a streamed location error are handled identically.