Services

API Interface / Android

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.

Precondition: MOVE SDK must be inREADYMoveSdkState.

fun startAutomaticDetection()

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.

Precondition: MOVE SDK must be inRunningMoveSdkState.

fun stopAutomaticDetection()

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.

Precondition: SDK must be inRUNNING MoveSdkState.

fun forceTripRecognition()
fun forceTripRecognition(duration: Long) 

Parameters

Description

duration

Long

Limit the high power detection to a certain amount of time in milliseconds, to not drain the battery. Default one minute (60 000ms)

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.

Precondition: MoveTripState should be in an active trip.

fun finishCurrentTrip()

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 ignoreCurrentTripAPI.

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.

fun ignoreCurrentTrip()

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.

Disabled by default.

Since it may be annoying to the user, it should only be enabled in case of problems.

fun keepInForeground(enabled: Boolean)

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.

Disabled by default.

Since this is consuming more battery, it should only be enabled in case of problems.

fun keepActive(enabled: Boolean)

Console logging

Toggles whether the MOVE SDK is allowed to log into the console or not.

Enabled by default.

fun consoleLogging(enabled: Boolean)
Parameter

enabled

Boolean that sets MOVE SDK console logging to enabled or not.

Get MOVE SDK State

Gets the current MoveSdkState.

fun getSDKState() : MoveSDKState

Return

Latest MoveSdkState.

Get Trip State

Gets the current MoveTripState.

fun getTripState(): MoveTripState

Get Device Status

Gets the current MoveDeviceStatus.

fun getDeviceStatus(): MoveDeviceStatus

Get Service Failures

Gets the current MoveServiceFailures.

func getServiceErrors(): List<MoveServiceFailure>

Return

A list of failed services.

Set Service Failure Listener

func setServiceFailureListener(listener: MoveErrorListener)

Provide a block to be invoked every time MoveServiceFailures change.

Callback

Block that gets invoked when service failure state changes.

Get Service Warnings

Gets the current MoveServiceWarnings.

func getServiceWarnings(): List<MoveServiceWarning>

Return

A list of partially working services.

Set Service Warning Listener

Provide a block to be invoked every time MoveServiceWarnings change.

fun setServiceWarningListener(listener: MoveWarningListener)

Callback

Block that gets invoked when service warnings change.

Delete Local Data

Deletes all the collected user MOVE SDK data stored on the device. This doesn't affect the MoveSdkState.

Precondition: MOVE SDK must be initialized.

fun deleteLocalData()

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.

Precondition: MOVE SDK must be initialized.

fun shutdown(force: Boolean = true, callback: ((MoveShutdownResult) -> Unit)? = null)

Parameters

Default

force

true

If true, shutdown executes immediately. Pending Data may be lost.

callback

null

Returns a MoveShutdownResult upon completion. May fail if not forced.

Geocoding

Geo-coordinate address lookup.

fun geocode(latitude: Double, longitude: Double, result: (GeocodeResult) -> Unit)

Parameter

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.

Throttle: Geocode is limited to a maximum of 100 lookups per hour.

Delete Local Data

Deletes all the collected user MOVE SDK data stored on the device. This doesn't affect the MoveSDKState.

Precondition: MoveSDKState should be initialized.

fun deleteLocalData()

Synchronize User Data

Used to force synchronizing user data with the MOVE backend. Limited to once per 2 minutes.

fun synchronizeUserData(result: ((Boolean) -> Unit)?)

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 to retrieve result

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.

fun initiateAssistanceCall(assistanceListener: AssistanceStateListener)

Parameters

assistanceListener

A callback returning a MoveAssistanceCallStatus.

Precondition: The assistance call service needs to be configured. The MOVE SDK needs to be in ready or running state.

Set Assistance MetaData

New feature in MOVE SDK 2.1.

fun setAssistanceMetaData(assistanceMetadataValue: String?)

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

Get a unique qualifier to identify the individual device. For Android returns null

fun getDeviceQualifier(): String?

Configuration services

Update authentication

Updates MOVE SDK MoveAuth. On MOVE SDK auth expiry, the Builder.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 MOVE SDK using the following API:

fun updateAuth(auth: MoveSdk.Auth, onError: (MoveAuthError) -> Unit)

Parameters

auth

Valid auth credentials

Callback

onError

Block that gets invoked on auth update completion error. On completion with error, MoveAuthError is passed.

Last updated

Change request #70: add MoveSdkAndroidConfig model