Services
API Interface / Android
Configuration services
Update Config
Change the config originally passed in setup.
fun updateConfig(config: MoveConfig, options: MoveOptions? = null)Parameters
Occasionally this functionality is needed for deployed apps when a projects configuration is updated on the backend.
Update authentication
Updates MOVE SDK MoveAuth. The host app was expected to fetch a new MoveAuth using its project API key and pass it to the MoveSDK using the following API:
@Deprecated("Do not use manual token update, this will be handled internally by the Move SDK")
fun updateAuth(auth: MoveSdk.Auth, onError: (MoveAuthError) -> Unit)Get MOVE SDK Config
Returns the active MoveConfig based on the current configuration source.
If useBackendConfig is enabled, the MOVE Dashboard configuration is returned. Otherwise, the local client configuration is returned.
Get MOVE auth state
Returns the current MoveAuthState.
Precondition: Returns UNKNOWN if SDK is in Uninitialised state.
Set Remote Config Change Listener
Provides a block to be invoked every time MoveConfig was successfully fetched from the server.
If the MoveConfig object couldn't be fetched from the server then a MoveConfigurationError ServiceUnreachable will be triggered.
Parameters
listener
A callback returning a MoveConfig object after a successful server fetch.
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 MOVE SDK services like driving detection, points of interest, walking and places. Stopping the service will set the MoveSdkState back to Ready.
Trip Services
Force Trip Recognition
Temporarily calibrates the MOVE SDK to the highest detection mode.
In order to optimize battery consumption, the MOVE SDK goes through different detection modes with different battery consumption levels, depending on the user's current behavior and activity. In general, the MOVE SDK is responsible for alternating between those different detection modes.
The MOVE 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 MOVE SDK is on the highest detection state to detect the trip faster.
Parameters
Type
duration
Long
Limit the high power detection to a certain amount of time in milliseconds, to not drain the battery. Default 60000ms (= 1 minute)
Manual Start Trip
Manually force the start of a trip, bypassing trip validation checks. This non-standard SDK usage may be feasible only in situations where active user input can be expected. Using the metadata parameter, self-defined information can be added to each trip which can be fetched from the timeline.
Finish Current Trip
Ends the current ongoing trip.
This API will end the ongoing trip and set MoveTripState back to .idle. The MOVE SDK is responsible for detecting the trip start and end points. The MOVE 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.
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.
Set Trip Start Listener
Provides a block to be invoked when a trip actually begins.
In comparison to the tripStateListener (only state changes) the tripStartListener will provide you with the start time of the actual trip.
Processing Services
Keep in foreground
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.
Keep active
To save battery consumption, the MOVE SDK is using several triggers to start its data listeners. In case of trouble, these triggers can be circumvented by allowing the MOVE SDK to stay active all the time. In that case the MOVE 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.
Console logging
Toggles whether the MOVE SDK is allowed to log into the console or not.
Parameters
enabled
Boolean that sets MOVE SDK console logging to enabled or not.
Mock locations
In Android it is possible to use simulated location by enabling it in the device developer mode. If you want the MOVE SDK to support those locations, you need to specify it. By default this is disabled to prevent wrong data.
Parameters
allow
Allows driving with mock locations. Should only be used in debug/test builds
Get MOVE SDK State
Gets the current MoveSdkState.
Return
Latest MoveSdkState.
Get Trip State
Gets the current MoveTripState.
Return
Latest MoveTripState.
Get Device Status
Gets the current MoveDeviceStatus.
Return
Latest MoveDeviceStatus.
Get Service Failures
Gets the current MoveServiceFailures.
Return
List of MoveServiceFailure
A list of failed services.
Set Service Error Listener
Provide a block to be invoked every time MoveServiceFailures will change.
Parameters
Block that gets invoked when service failure state changes.
Get Service Warnings
Gets the current MoveServiceWarnings.
Return
List of MoveServiceWarnings
A list of partially working services.
Set Service Warning Listener
Provide a block to be invoked every time MoveServiceWarnings will change.
Listener
Block that gets invoked when service warnings change.
Set Log Listener
Provide a block to be invoked every time a new SDK log event occurs.
Shutdown SDK
Shutdown SDK shared instance.
Stops SDK services, send the queued user data, and de-initializes the MOVE SDK. After .shutdown() is executed, the MoveSdkState will transit to Uninitialised.
Parameters
Default
force
true
If true, shutdown executes immediately. Pending Data may be lost.
timeoutSeconds
null
If timeoutSeconds > 0, a graceful shutdown is performed regardless of force: the callback resolves immediately with SUCCESS, and the SDK keeps retrying to send pending data in the background until the queue is empty or the timeout expires, after which it shuts down and discards remaining data.
Set Health Score Listener
Provide a block to be invoked every time MoveHealthScore will change.
Parameters
Block that get's invoked when the health score changes.
Geocoding
Geo-coordinate address lookup.
Parameters
latitude
Geo-coordinate latitude
longitude
Geo-coordinate longitude
completion
Callback that returns a Result with an address String or a MoveGeocodeError
Geocode will try a reverseGeocodeLocation or fallback to contacting the MOVE backend to attempt a geo-lookup.
Delete Local Data
Deletes all the collected user MOVE SDK data stored on the device. This doesn't affect the MoveSDKState.
Synchronize User Data
Used to force synchronizing user data with the MOVE backend. Limited to once per 2 minutes.
The result Returns FALSE in case there are Timeline-relevant packages in the queue that remain to be sent to the MOVE backend; and it returns TRUE in case the queue is empty.
Parameters
result
Optional callback. Returns true if the queue is empty and all data has been sent to the backend. Returns false if there are still pending items in the queue.
Other services
Live Location TAG
Adds a Tag (=string value) to trip events. This Tag information is added to the timeline data.
To clear the Tag pass null as parameter.
After a shutdown(...) (Android / iOS) the Tag is also cleared.
Parameters
tag
String [a-z] [0-9] and null to clear the Tag.
Return values
true
Live Location Tag is applied.
true
Live Location Tag is cleared. (parameter null)
false
Live Location Tag exceeds the limit of 200 characters.
false
Live Location Tag is blank or empty.
false
If the passed chars are not one of these [a-z] [0-9].
Initiate Assistance Call
Initiate an assistance call to emergency services.
Parameters
assistanceListener
A callback returning a MoveAssistanceCallStatus.
Set Assistance MetaData
Get a unique qualifier to identify the individual device.
Parameters
assistanceMetadataValue
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.
Get Device Qualifier
Returns the Android ID (Settings.Secure.ANDROID_ID) — a unique 64-bit hex string per app and device (app-scoped since Android 8.0).
The device qualifier should be passed to the backend during user registration. See Move backend.
Resolve Error
Forces a permission recheck. This is handled internally by the SDK. Manual calls are not required.
Device Discovery
Device discovery for Bluetooth devices. Multiple devices can be registered.
The configuration of the scanning will be done with the object DeviceDiscovery in MoveOptions during MOVE SDK setup. From the start of a trip registered devices are scanned after a startDelay and are scanned for duration. This scan will repeat after an interval.
To scan for Bluetooth devices only once then the flag stopScanOnFirstDiscovered should be set.
Device scanning results are appended to the trip metadata.
Registering/unregistering devices during a trip may result in undefined behavior.
Set Device Discovery Listener
Set a device discovery listener to be fired when registered MoveDevice's are scanned.
Parameters
listener -> DeviceDiscoveryListener
A callback returning a MoveScanResult.
Set MoveDevice Connection State Listener
Set a MoveDevice connection state listener to be fired when the Bluetooth connection state of a previously registered MoveDevice has changed.
Parameters
listener -> MoveDeviceStateListener
A callback returning the MoveDevice which connection state was changed.
Register Device
Register MoveDevice's / add more MoveDevice's:
Parameters
devices
A list of MoveDevice's to be scanned during a trip.
Unregister Device
Unregister a MoveDevice:
Parameters
devices
A list of MoveDevice's that should no longer be scanned during a trip.
Return
Boolean
true:
If the unregistration of the MoveDevice on the backend was successful.
false:
If the MOVE SDK is not initialised.
If there is an error during the MoveDevice unregistration process. See MoveDeviceStateListener
Throws
IllegalArgumentException
If the beacon device Id is not a valid UUID.
If the length of device display name is longer than 1000 characters.
Get Registered Devices
Get current registered MoveDevice's.
Alternative it is possible to subscribe to registered devices changes.
Additional device discovery methods
Converts android.bluetooth.le.ScanResult into a MOVE SDK specific MoveDevice.
Converts android.bluetooth.BluetoothDevice into a MOVE SDK specific MoveDevice.
Step Counter (via Google Health Connect)
Only available if this feature is enabled in the backend (MOVE SDK Dashboard) and the user grants the permission android.permission.health.READ_STEPS . To collect steps even the app is in background, the permissionandroid.permission.health.READ_HEALTH_DATA_IN_BACKGROUND is required.
For more information regarding Health Connect please see Android - Health Connect.
Add the following permissions to your AndroidManifest.xml file :
Also you need to intent filter for Health Connect permission handling:
See also MoveServiceFailure for permissions and Health Connect related errors.
Last updated