Skip to content

Constants

Every constant is a Swift enum with a raw value carrying the number or string the engine exchanges. Config takes the raw value, so pass DesiredAccuracy.high.rawValue rather than the case itself.

Desired accuracy

Config(desiredAccuracy: DesiredAccuracy.high.rawValue)
ConstantValueMeaning
.navigation-2Highest precision; only for turn-by-turn. Heaviest battery cost.
.high-1GPS-grade. The default, and what tracking is tuned for.
.medium10~10 m; balanced provider, GPS may not engage.
.low100~100 m; network/cell-grade.
.veryLow1000~1 km.
.lowest3000~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.rawValue)
ConstantValue
.off0
.error1
.warning2
.info3
.debug4
.verbose5

This controls persistence only: the engine always mirrors its lines to os_log. 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.

ConstantValueMeaning
.notDetermined0Nothing asked yet.
.restricted1Blocked by policy (device management).
.denied2Refused; no location.
.always3Background location granted.
.whenInUse4Foreground only.

Accuracy authorization

ConstantValueMeaning
.full0Precise location.
.reduced1The user granted approximate location only (API 31+).

Reported by getProviderState(). Approximate location (iOS 14+) is a coarse grid: most fixes fail the accuracy gate and tracking is effectively unusable, so it is worth surfacing to the user — or asking for a temporary upgrade with requestTemporaryFullAccuracy(purpose:) — rather than debugging it as a bug.

Activity types

The classification behind the motion state machine, on onMotionChange and location.activity.type.

ConstantWire value
.stillstill
.onFooton_foot
.walkingwalking
.runningrunning
.onBicycleon_bicycle
.inVehiclein_vehicle
.unknownunknown

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

BGeoError is a plain Error carrying the engine’s own code and message. It is deliberately not an enum: a code this SDK version has never seen stays diagnosable through code verbatim instead of collapsing into a .unknown case.

CodeWhen
LICENSE_MISSINGRelease build, no key in Info.plist
LICENSE_INVALIDBad signature or malformed token
LICENSE_EXPIREDKey expired before this SDK build
LICENSE_APP_MISMATCHKey not bound to this bundle id / Team ID
DISABLEDOperation needs tracking to be running
NOT_FOUNDNo such record (e.g. destroyLocation with an unknown uuid)
INVALID_GEOFENCEMissing identifier, non-positive radius, bad coordinates
DECODE_ERRORThe engine sent something this SDK could not decode
do {
try await BackgroundGeolocation.start()
} catch let error as BGeoError {
switch error.code {
case "LICENSE_EXPIRED": showRenewalPrompt()
default: print("bgeo:", error.code, error.message ?? "")
}
}

The same codes arrive through onLocationError as a LocationErrorEvent, so a thrown getCurrentPosition() failure and a streamed watch failure are handled the same way.