Dolphin MOVE SDK
2.x
2.x
  • Introduction
  • MOVE Services
  • MOVE SDK
    • Getting Started
      • MOVE Dashboard
        • Access Control
        • Configuration
        • Timeline
        • Points of Interest
      • Android
        • Installation
        • Quick Start
      • iOS
        • Installation
        • Quick Start
        • Troubleshooting
      • React Native
      • Flutter
      • Move SDK CLI
    • API Interface
      • Android
        • Initialization
        • Services
      • iOS
        • Initialization
        • Setup
        • Services
      • React Native
        • Components
        • Initialization
        • Services
      • Flutter
        • Initialization
        • Services
    • Models
      • Listeners/Callbacks
      • MoveAssistanceCallStatus
      • MoveAuth
      • MoveAuthError
      • MoveAuthResult
      • MoveAuthState
      • MoveConfig
      • MoveConfigurationError
      • MoveDevice
      • MoveDeviceStatus
      • MoveGeocodeError
      • MoveHealthItem
      • MoveHealthScore
      • MoveOptions
        • DeviceDiscovery
      • MoveSdkState
      • MoveSdkAndroidConfig
      • MoveTripState
      • MoveScanResult
      • MoveServiceFailure
      • MoveServiceWarning
      • MoveShutdownResult
    • Appendix
      • Token refresh
      • Android
        • Permission Handling
          • Permission Overview
          • Runtime Permissions
        • Battery optimization
        • Notification Management
      • iOS
        • Permissions Handling
        • App Store
      • React Native
        • Permission Handling
  • MOVE Backend
    • MOVE Backend
      • MOVE Admin API
      • MOVE TIMELINE API
      • MOVE State API
      • MOVE Last Location API
    • MOVE Generic Notifier
    • MOVE Assistance Notifier
    • Example requests
  • FAQ
  • Changelog
    • Android
    • iOS
    • React
    • Flutter
    • Backend
  • Data privacy (GDPR)
Powered by GitBook
On this page
  • Update Config
  • Detection Services
  • Start Automatic Detection
  • Stop Automatic Detection
  • Trip Services
  • Force Trip Recognition
  • Manual Start Trip
  • Finish Current Trip
  • Ignore Current Trip
  • Set Trip Start Listener
  • Processing Services
  • Keep in foreground
  • Keep active
  • Console logging
  • Mock locations
  • Get MOVE SDK State
  • Get Trip State
  • Get Device Status
  • Get Service Failures
  • Set Service Error Listener
  • Get Service Warnings
  • Set Service Warning Listener
  • Shutdown SDK
  • Set Health Score Listener
  • Geocoding
  • Delete Local Data
  • Synchronize User Data
  • Other services
  • Live Location TAG
  • Initiate Assistance Call
  • Set Assistance MetaData
  • Get Device Qualifier
  • Device Discovery
  • Set Device Discovery Listener
  • Set MoveDevice Connection State Listener
  • Register Device
  • Unregister Device
  • Get Registered Devices
  • Additional device discovery methods
  • Configuration services
  • Update authentication
  • Set Remote Config Change Listener
  1. MOVE SDK
  2. API Interface
  3. Android

Services

API Interface / Android

PreviousInitializationNextiOS

Last updated 1 month ago

Update Config

Change the config originally passed in setup.

fun updateConfig(config: MoveConfig, options: MoveOptions? = null)

Parameters

config

Move services configuration.

options

Optional MoveOptions if they need to be changed.

Occasionally this functionality is needed for deployed apps when a projects configuration is updated on the backend.

Detection Services

Start Automatic Detection

Starts the required detection services stated in the passed on initialization. Starting the service will set the to Running.

Precondition: MOVE SDK must be inREADY.

fun startAutomaticDetection()

Stop Automatic Detection

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.

fun forceTripRecognition()
fun forceTripRecognition(duration: Long) 

Parameters

Type

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)

Manual Start Trip

fun startTrip(metadata: Map<String, String>?)

Be sure that you set the start flag to false during the MOVE SDK setup.

e.g.: setup( auth = moveAuth, config = moveConfig, start = false )

Manually starting a trip bypasses additional trip detection checks. It is strongly recommended to finish manually started trips with finishCurrentTrip()

Starting a trip with startTrip(...) prevents the execution of startAutomaticDetection().

Finish Current Trip

Ends the current ongoing 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.

Ignore Current Trip

Ignores the current ongoing trip.

fun ignoreCurrentTrip()

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.

fun setTripStartListener(listener: TripStartListener)

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

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)

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.

Points of Interests are not supported with mock locations. Keep in mind that mock locations may have negative impact on trip recognition afterwards.

Rooted devices are still able to send mock locations without allowing mock locations.

.allowMockLocations(allow: Boolean)

Parameters

allow

Allows driving with mock locations. Should only be used in debug/test builds

Get MOVE SDK State

fun getSDKState() : MoveSDKState

Return

Get Trip State

fun getTripState(): MoveTripState

Return

Get Device Status

fun getDeviceStatus(): MoveDeviceStatus

Return

Get Service Failures

func getServiceErrors(): List<MoveServiceFailure>

Return

A list of failed services.

Set Service Error Listener

func setServiceErrorListener(listener: MoveErrorListener)

Parameters

Block that gets invoked when service failure state changes.

Get Service Warnings

func getServiceWarnings(): List<MoveServiceWarning>

Return

A list of partially working services.

Set Service Warning Listener

fun setServiceWarningListener(listener: MoveWarningListener)

Listener

Block that gets invoked when service warnings change.

Shutdown SDK

Shutdown SDK shared instance.

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

Set Health Score Listener

fun setMoveHealthScoreListener(listener MoveHealthScoreListener)

Parameters

Block that get's invoked when the health score changes.

Geocoding

Geo-coordinate address lookup.

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

Parameters

latitude

Geo-coordinate latitude

longitude

Geo-coordinate longitude

completion

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

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

Live Location TAG

New feature since MOVE SDK 2.8.0

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.

fun setLiveLocationTag(tag: String?): Boolean

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.

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

fun initiateAssistanceCall(assistanceListener: AssistanceStateListener)

Parameters

assistanceListener

Set Assistance MetaData

New feature since MOVE SDK 2.1.

fun setAssistanceMetaData(assistanceMetadataValue: String?)

Before SDK 2.4 Android returns null.

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

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

fun getDeviceQualifier(): String?

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.

Registering/unregistering devices during a trip may result in undefined behavior.

Set Device Discovery Listener

fun deviceDiscoveryListener(listener: DeviceDiscoveryListener)

Parameters

Set MoveDevice Connection State Listener

Since MOVE SDK v2.10.0

fun setDeviceStateListener(listener: MoveDeviceStateListener?)

Parameters

Register Device

Please note that MoveDevices can only be registered if the SDK has been configured with .setup()

fun registerDevices(devices: List<MoveDevice>)

Parameters

devices

Unregister Device

fun unregisterDevices(devices: List<MoveDevice>)

Parameters

devices

Get Registered Devices

suspend fun getRegisteredDevices(): List<MoveDevice>

Alternative it is possible to subscribe to registered devices changes.

fun getRegisteredDevicesFlow(): Flow<List<MoveDevice>>

Additional device discovery methods

fun convertToMoveDevice(scanResult: ScanResult): MoveDevice
fun convertToMoveDevice(bluetoothDevice: BluetoothDevice): MoveDevice

Configuration services

Update authentication

Deprecated: Token expiry is no longer a valid auth state forwarded to the app and does not need to be handled.

@Deprecated("Do not use manual token update, this will be handled internally by the Move SDK")
fun updateAuth(auth: MoveSdk.Auth, onError: (MoveAuthError) -> Unit)

Set Remote Config Change Listener

Since MOVE SDK v2.5

fun setRemoteConfigChangeListener(listener: RemoteConfigChangeListener)

Parameters

listener

A callback returning a MoveConfig object after a successful server fetch.

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 back to Ready.

Precondition: MOVE SDK must be inRunning.

Precondition: SDK must be inRUNNING .

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 .

Precondition: MOVE SDK must be in.ready.

This API will end the ongoing trip and set 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: should be in an active trip.

More information about trip states can be found in .

If the trip was started with finishCurrentTrip() brings the SDK back to .ready state.

This API will set the ongoing to .ignored. Data of ignored trips is purged and not sent to the server.

Precondition: should be in an active trip.

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) is always visible to the user.

Gets the current.

Latest .

Gets the current .

Latest .

Gets the current .

Latest .

Gets the current .

List of

Provide a block to be invoked every time will change.

Gets the current .

List of

Provide a block to be invoked every time will change.

Stops SDK services, send the queued user data, and de-initializes the MOVE SDK. After .shutdown() is executed, the will transit to Uninitialised.

Returns a upon completion. May fail if not forced.

Provide a block to be invoked every time MoveHealthScorewill change.

Callback that returns a Result with an address String or a

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

Precondition: should be initialized.

After a shutdown(...) ( / ) the Tag is also cleared.

New feature in MOVE SDK 2.x; configuration in MOVE dashboard pending - please .

A callback returning a .

The device qualifier should be passed to the backend during user registration. See .

Device scanning results are appended to the trip .

Before the DeviceDiscovery configuration can be changed, a with a following must be executed.

Set a device discovery listener to be fired when registered 's are scanned.

If of the object is set to true then the list of MoveScanResults may be incomplete.

listener ->

A callback returning a .

Set a connection state listener to be fired when the Bluetooth connection state of a previously registered has changed.

listener ->

A callback returning the which connection state was changed.

Register 's / add more 's:

A list of 's to be scanned during a trip.

Unregister a :

All devices are unregistered after .

A list of 's that should no longer be scanned during a trip.

Get current registered 's.

Converts into a MOVE SDK specific .

Converts into a MOVE SDK specific .

Updates MOVE SDK . The host app was expected to fetch a new using its project API key and pass it to the MoveSDK using the following API:

Provides a block to be invoked every time was successfully fetched from the server.

If the MoveConfig object couldn't be fetched from the server then a ServiceUnreachable will be triggered.

MoveConfig
MoveSdkState
MoveSdkState
MoveSdkState
MoveSdkState
MoveSdkState
MoveSdkState
MoveTripState
MoveTripState
MoveTripState
MoveTripState
MoveTripState
notification handling
MoveSdkState
MoveTripState
MoveDeviceStatus
MoveServiceWarnings
MoveSdkState
MoveSDKState
MoveSDKState
get in touch
android.bluetooth.le.ScanResult
MoveDevice
android.bluetooth.BluetoothDevice
MoveDevice
MoveAuth
MoveAuth
MoveConfig
MoveConfigurationError
startTrip(metadata:)
Android
iOS
MoveSdkState
MoveSdkState
MoveTripState
MoveTripState
MoveDeviceStatus
MoveDeviceStatus
MoveScanResult
MoveDevice
metadata
shutdown
setup
MoveServiceFailures
MoveServiceFailures
MoveServiceFailure
MoveServiceWarnings
MoveServiceWarnings
Move backend
MoveDevice
MoveDevice
MoveDevice
MoveDevice
MoveDevice
MoveDevice
MoveDevice
MoveDevice
MoveDevice
DeviceDiscovery
MoveOptions
shutdown
MoveConfig
MoveErrorListener
MoveWarningListener
MoveHealthScoreListener
DeviceDiscoveryListener
MoveDeviceStateListener
MoveShutdownResult
timeline
MoveGeocodeError
MoveAssistanceCallStatus
stopScanOnFirstDiscovered