Skip to content

Constants

Every constant below is attached to the default export (BackgroundGeolocation.DESIRED_ACCURACY_HIGH) and importable individually:

import BackgroundGeolocation, { DESIRED_ACCURACY_HIGH } from '@dc-bgeo/react-native-background-geolocation';

Values are chosen to be Transistor-compatible by design — if you’re porting from react-native-background-geolocation, these constants (and the config keys and event payloads that use them) carry the same numbers and strings.

Desired accuracy

DESIRED_ACCURACY_* values for config.desiredAccuracy and the desiredAccuracy option on getCurrentPosition() / watchPosition(). Lower (more negative) values request better accuracy; larger values are coarser and cheaper.

ConstantValueMeaning
DESIRED_ACCURACY_NAVIGATION-2Best accuracy, tuned for turn-by-turn navigation.
DESIRED_ACCURACY_HIGH-1Best accuracy, no navigation-specific tuning.
DESIRED_ACCURACY_MEDIUM10~10 metre accuracy tier.
DESIRED_ACCURACY_LOW100~100 metre accuracy tier.
DESIRED_ACCURACY_VERY_LOW1000~1 kilometre accuracy tier.
DESIRED_ACCURACY_LOWEST3000~3 kilometre accuracy tier.

Each value maps to a native accuracy/priority tier:

ConstantiOS (CLLocationManager.desiredAccuracy)Android (fused location Priority)
DESIRED_ACCURACY_NAVIGATIONkCLLocationAccuracyBestForNavigationPRIORITY_HIGH_ACCURACY
DESIRED_ACCURACY_HIGHkCLLocationAccuracyBestPRIORITY_HIGH_ACCURACY
DESIRED_ACCURACY_MEDIUMkCLLocationAccuracyNearestTenMetersPRIORITY_HIGH_ACCURACY
DESIRED_ACCURACY_LOWkCLLocationAccuracyHundredMetersPRIORITY_BALANCED_POWER_ACCURACY
DESIRED_ACCURACY_VERY_LOWkCLLocationAccuracyKilometerPRIORITY_LOW_POWER
DESIRED_ACCURACY_LOWESTkCLLocationAccuracyThreeKilometersPRIORITY_LOW_POWER

On Android the mapping is bucketed by threshold (≤10 → PRIORITY_HIGH_ACCURACY, ≤100 → PRIORITY_BALANCED_POWER_ACCURACY, otherwise PRIORITY_LOW_POWER), so DESIRED_ACCURACY_MEDIUM 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

LOG_LEVEL_* values for config.logLevel — see the logging & debugging guide for what gets persisted at each level.

ConstantValueMeaning
LOG_LEVEL_OFF0Nothing persisted (default).
LOG_LEVEL_ERROR1Errors only.
LOG_LEVEL_WARNING2Warnings and above.
LOG_LEVEL_INFO3Informational and above.
LOG_LEVEL_DEBUG4Debug and above.
LOG_LEVEL_VERBOSE5Everything.

Authorization status

AUTHORIZATION_STATUS_* values resolved by requestPermission() and getProviderState(), and carried as status on the ProviderChangeEvent delivered to onProviderChange.

ConstantValueMeaning
AUTHORIZATION_STATUS_NOT_DETERMINED0Not yet requested.
AUTHORIZATION_STATUS_RESTRICTED1Restricted (e.g. parental controls).
AUTHORIZATION_STATUS_DENIED2Denied by the user.
AUTHORIZATION_STATUS_ALWAYS3Always — background tracking is authorized.
AUTHORIZATION_STATUS_WHEN_IN_USE4Foreground-only authorization.

3 (AUTHORIZATION_STATUS_ALWAYS) is the value apps should compare onProviderChange’s status against to confirm background tracking is actually authorized, rather than merely foreground-authorized.

Accuracy authorization

ACCURACY_AUTHORIZATION_* values resolved by requestTemporaryFullAccuracy() and carried as the optional accuracyAuthorization field on ProviderChangeEvent (iOS only).

ConstantValueMeaning
ACCURACY_AUTHORIZATION_FULL0Full accuracy.
ACCURACY_AUTHORIZATION_REDUCED1Reduced accuracy (iOS 14+ “Approximate Location”).

License codes

LICENSE_* string codes rejected by ready()/start() (and getCurrentPosition()/watchPosition()) in a release build with an invalid license — see License keys. Debug builds run unlicensed and never reject with these codes.

ConstantValueMeaning
LICENSE_MISSING'LICENSE_MISSING'No key present in a release build.
LICENSE_INVALID'LICENSE_INVALID'Bad signature or malformed token.
LICENSE_EXPIRED'LICENSE_EXPIRED'Key expired before this SDK build.
LICENSE_APP_MISMATCH'LICENSE_APP_MISMATCH'Key not bound to this app id / certificate / Team ID.

Activity types

ACTIVITY_TYPE_* string values — the vocabulary for config.triggerActivities and MotionActivity.type.

ConstantValue
ACTIVITY_TYPE_STILL'still'
ACTIVITY_TYPE_ON_FOOT'on_foot'
ACTIVITY_TYPE_WALKING'walking'
ACTIVITY_TYPE_RUNNING'running'
ACTIVITY_TYPE_ON_BICYCLE'on_bicycle'
ACTIVITY_TYPE_IN_VEHICLE'in_vehicle'
ACTIVITY_TYPE_UNKNOWN'unknown'