Services
API Interface / React Native
Detection Services
Start Automatic Detection
Starts the required detection services stated in the MoveConfig passed on initialization. Starting the service will set the MoveSDKState to .running
.
Stop Automatic Detection
Stops the automatic detection service, including all SDK services like driving detection, points of interest, walking and places. Stopping the service will set the MoveSDKState back to .ready
.
Force Trip Recognition
Temporarily calibrates the SDK to the highest detection mode.
In order to optimize battery consumption, the SDK goes through different detection modes with different battery consumption levels, depending on the user's current behavior and activity. In general, the SDK is responsible for alternating between those different detection modes.
The SDK also provides hosting apps this API to call if they have their own reasons (like buttons, sensors or beacons) to believe that the user is starting a trip. This will make sure the SDK is on the highest detection state to detect the trip faster.
Finish Current Trip
Ends the current ongoing trip.
This API will end the ongoing trip and set MoveTripState back to .idle
. The SDK is responsible for detecting the trip start and end points. The SDK also provides hosting apps this API to call if they have their own reasons (like sensors or beacons) to believe that the user's trip has ended.
Precondition: MoveTripState should be in an active trip.
If this API is called while the user is active on a driving trip, a new trip will start again right away. If the intention is to un-track the ongoing trip, call ignoreCurrentTrip
API.
More information about trip states can be found in MoveTripState.
Ignore Current Trip
Ignores the current ongoing trip.
This API will set the ongoing MoveTripState to .ignored
. Data of ignored trips is purged and not sent to the server.
Precondition: MoveTripState should be in an active trip.
Processing Services
Keep in foreground (Android only)
When an Android application is in the background it may receive limited data (location, sensors, etc.). To improve this behavior, it is possible to put the application always in the foreground with a visible notification that cannot be discarded. Just because it's visible it doesn't mean that it is performing any data collection at all. So this should not have any significant battery impact at all.
Disabled by default. Since it may be annoying to the user, it should only be enabled in case of problems.
Keep active (Android only)
To save battery consumption, the SDK is using several triggers to start its data listeners. In case of trouble, these triggers can be circumvented by allowing the MoveSdk to stay active all the time. In that case the SDK is always monitoring required data and is therefore consuming more battery. Depending on the configuration, it may happen that the notification (see notification handling) is always visible to the user.
Disabled by default. Since this is consuming more battery, it should only be enabled in case of problems.
Get SDK State
Gets the current MoveSDKState.
Get Trip State
Get the current MoveTripState.
Get Auth State
Get the current MoveAuthState.
Set SDK State Listener
Provide a block to be invoked every time MoveSDKState changes.
Set the MoveSDKState listener before initializing the SDK to anticipate the SDK State changes triggered by the initialization API.
Here the host app can start the SDK services when MoveSDKState is.ready
or handle errors if occurred.
Callback | |
sdkStateChanged | Block that gets invoked every time MoveSDKState is changed and provides the updated MoveSDKState. |
Set SDK Auth State Listener
Provide a block to be invoked every time MoveAuthState changes.
Callback | |
authStateChanged | Block that gets invoked every time MoveAuthState is updated. |
Authentication Expiry
The host app is expected to monitor MoveAuthState updates viaauthStateUpdateListene
API and handle those changes accordingly.
Check Authentication updates and expiry for more details about authentication expiry and renewal.
Set Trip State Listener
Provide a block to be invoked every time MoveTripState changes.
Callback | |
tripStateChanged | Block that gets invoked every time MoveTripState is changed and provides the updated MoveTripState. |
Set Errors Listener
Provide a block to be invoked every time MoveServiceFailure changes.
Set Warnings Listener
Provide a block to be invoked every time MoveServiceWarning changes.
Shutdown SDK
Shutdown SDK shared instance.
Stops SDK services, send the queued user data, and de-initializes the SDK. After that is executed, the MoveSDKState will transit to .uninitialized
.
Precondition: SDK must be initialized.
Parameters | Default | |
force | true | If true, shutdown executes immediately. Pending Data may be lost. |
Resolve Error
Synchronize User Data
Used to force synchronizing user data with the SDK server. Limited to once per 2 minutes.
Other Services
Initiate Assistance Call
New feature in MOVE SDK 2.x; configuration in MOVE dashboard pending - please get in touch.
Initiate an assistance call to emergency services.
Returns a promise with a MoveAssistanceCallStatus.
Precondition: The assistance call service needs to be configured in the MOVE dashboard. The SDK needs to be in ready or running state.
Set Assistance MetaData
New feature in MOVE SDK 2.1
Parameters | ||
String | A string to be sent with each assistance call or impact |
The metadata string is set once, and then sent to the server with each and every manual assistance call and with AID report. The contents of the string can be anything, e.g. JSON data. The assistance data is persisted once set.
Configuration services
Update authentication
Updates SDK MoveAuth. On SDK auth expiry, the authStateListener will trigger expired state. The host app is expected to fetch a new MoveAuth using its project API key and pass it to the MoveSDK using the following API:
Parameters | |
---|---|
auth | The user's updated Auth object with the new token. |
Last updated