Constants
Every constant below is a Dart top-level const exported from the package
root (lib/src/constants.dart), not an enum member — import them directly
alongside the BackgroundGeolocation facade:
import 'package:bgeo_background_geolocation/bgeo_background_geolocation.dart' as bg;
final accuracy = bg.desiredAccuracyHigh; // -1Values are chosen to be Transistor-compatible
by design — if you’re porting from react-native-background-geolocation or
its native Transistorsoft equivalents, these constants (and the config keys
and event payloads that use them) carry the same numbers and strings.
Desired accuracy
desiredAccuracy* values for Config.desiredAccuracy
and the desiredAccuracy field on
CurrentPositionOptions /
WatchPositionOptions. Lower
(more negative) values request better accuracy; larger values are coarser and
cheaper.
| Constant | Value | Meaning |
|---|---|---|
desiredAccuracyNavigation | -2 | Best accuracy, tuned for turn-by-turn navigation. |
desiredAccuracyHigh | -1 | Best accuracy, no navigation-specific tuning. |
desiredAccuracyMedium | 10 | ~10 metre accuracy tier. |
desiredAccuracyLow | 100 | ~100 metre accuracy tier. |
desiredAccuracyVeryLow | 1000 | ~1 kilometre accuracy tier. |
desiredAccuracyLowest | 3000 | ~3 kilometre accuracy tier. |
Each value maps to a native accuracy/priority tier:
| Constant | iOS (CLLocationManager.desiredAccuracy) | Android (fused location Priority) |
|---|---|---|
desiredAccuracyNavigation | kCLLocationAccuracyBestForNavigation | PRIORITY_HIGH_ACCURACY |
desiredAccuracyHigh | kCLLocationAccuracyBest | PRIORITY_HIGH_ACCURACY |
desiredAccuracyMedium | kCLLocationAccuracyNearestTenMeters | PRIORITY_HIGH_ACCURACY |
desiredAccuracyLow | kCLLocationAccuracyHundredMeters | PRIORITY_BALANCED_POWER_ACCURACY |
desiredAccuracyVeryLow | kCLLocationAccuracyKilometer | PRIORITY_LOW_POWER |
desiredAccuracyLowest | kCLLocationAccuracyThreeKilometers | PRIORITY_LOW_POWER |
On Android the mapping is bucketed by threshold (≤10 → PRIORITY_HIGH_ACCURACY,
≤100 → PRIORITY_BALANCED_POWER_ACCURACY, otherwise PRIORITY_LOW_POWER), so
desiredAccuracyMedium and better all resolve to the same Android priority
even though iOS distinguishes them further. Leaving desiredAccuracy unset
defaults to kCLLocationAccuracyBest / PRIORITY_HIGH_ACCURACY on their
respective platforms.
Log level
logLevel* values for Config.logLevel —
see the logging & debugging guide for what
gets persisted at each level.
| Constant | Value | Meaning |
|---|---|---|
logLevelOff | 0 | Nothing persisted (default). |
logLevelError | 1 | Errors only. |
logLevelWarning | 2 | Warnings and above. |
logLevelInfo | 3 | Informational and above. |
logLevelDebug | 4 | Debug and above. |
logLevelVerbose | 5 | Everything. |
Authorization status
authorizationStatus* values resolved by
requestPermission()
and getProviderState(),
and carried as status on the
ProviderChangeEvent
delivered to onProviderChange.
| Constant | Value | Meaning |
|---|---|---|
authorizationStatusNotDetermined | 0 | Not yet requested. |
authorizationStatusRestricted | 1 | Restricted (e.g. parental controls). |
authorizationStatusDenied | 2 | Denied by the user. |
authorizationStatusAlways | 3 | Always — background tracking is authorized. |
authorizationStatusWhenInUse | 4 | Foreground-only authorization. |
3 (authorizationStatusAlways) is the value apps should compare
onProviderChange’s status against to confirm background tracking is
actually authorized, rather than merely foreground-authorized.
Accuracy authorization
accuracyAuthorization* values resolved by
requestTemporaryFullAccuracy()
and carried as the optional accuracyAuthorization field on
ProviderChangeEvent (iOS only).
| Constant | Value | Meaning |
|---|---|---|
accuracyAuthorizationFull | 0 | Full accuracy. |
accuracyAuthorizationReduced | 1 | Reduced accuracy (iOS 14+ “Approximate Location”). |
License codes
license* string constants rejected by ready()/start() (and
getCurrentPosition()/watchPosition()) in a release build with an
invalid license, surfaced as the code of a PlatformException — see
License keys. Debuggable builds and
the iOS simulator run unlicensed and never reject with these codes.
| Constant | Value | Meaning |
|---|---|---|
licenseMissing | 'LICENSE_MISSING' | No key present in a release build. |
licenseInvalid | 'LICENSE_INVALID' | Bad signature or malformed token. |
licenseExpired | 'LICENSE_EXPIRED' | Key expired before this SDK build. |
licenseAppMismatch | 'LICENSE_APP_MISMATCH' | Key not bound to this app id / certificate / Team ID. |
Activity types
activityType* string values — the vocabulary for
Config.triggerActivities
and MotionActivity.type.
| Constant | Value |
|---|---|
activityTypeStill | 'still' |
activityTypeOnFoot | 'on_foot' |
activityTypeWalking | 'walking' |
activityTypeRunning | 'running' |
activityTypeOnBicycle | 'on_bicycle' |
activityTypeInVehicle | 'in_vehicle' |
activityTypeUnknown | 'unknown' |