Whether the SDK has been enabled via start or startGeofences.
Whether the SDK is currently in the moving state (vs stationary).
true when a schedule is configured and startSchedule() executed.
stopSchedule() will set this to false.
Tracking mode.
| Value | Name | Description |
|---|---|---|
| 0 | Geofences | Monitor geofences only. |
| 1 | Location | Monitor location + geofences. |
Current distance-traveled in meters. See: odometerError, BackgroundGeolocation.setOdometer, BackgroundGeolocation.getOdometer.
The accumulated error in the odometer (in meters).
iOS only. true when the app was launched in the background due to a
background event (fetch, geofence exit, stationary geofence exit).
Always false on Android.
Indicates if the app was launched after a device reboot.
OptionalresetReset the plugin to its initial state before applying this configuration. This is probably what you want.
Defaults to true
If you set this to false, the SDK will consume your Config only at the first install of your app. Thereafter, the only way
to change your configuration will be to call BackgroundGeolocation.setConfig,
You will certainly NOT want to use reset: false during development, as it will prevent your configuration changes from taking effect on subsequent app launches.
OptionalloggerLogger configuration.
OptionalgeolocationGeolocation configuration.
OptionalhttpHTTP configuration.
OptionalappApp configuration.
OptionalpersistencePersistence configuration.
OptionalactivityMotion Activity configuration.
OptionalauthorizationAuthorization configuration.
OptionaltransistorConvenience option to automatically configures the SDK to upload locations to the Transistor Software demo server at http://tracker.transistorsoft.com (or your own local instance of background-geolocation-console)
See TransistorAuthorizationService. This option will automatically configure the HttpConfig.url to point at the Demo server as well as well as the required AuthorizationConfig configuration.
const token = await
BackgroundGeolocation.findOrCreateTransistorAuthorizationToken("my-company-name", "my-username");
BackgroundGeolocation.ready({
transistorAuthorizationToken: token
});
This convenience option merely performs the following [[Authorization]] configuration automatically for you:
// Base url to Transistor Demo Server.
const url = "http://tracker.transistorsoft.com";
// Register for an authorization token from server.
const token = await
BackgroundGeolocation.findOrCreateTransistorAuthorizationToken("my-company-name", "my-username");
BackgroundGeolocation.ready({
url: url + "/api/locations",
authorization: {
strategy: "JWT",
accessToken: token.accessToken,
refreshToken: token.refreshToken,
refreshUrl: url + "/v2/refresh_token",
refreshPayload: {
refresh_token: "{refreshToken}"
},
expires: token.expires
}
});
Effective runtime state returned by
BackgroundGeolocation.ready/getState.Stateis the active Config (compound), plus runtime-only fields.