Initialization

This page shows what can be configured for the MOVE SDK.

Builder

The Android MOVE SDK must be initialized by using the MoveSdk.Builder. It can be configured with different configurations. Once the configuration is passed, initmust be called to initialize and retrieve an instance of the MOVE SDK. This instance can then be used to control SDK services. Check API Interface for more details.

Authentication

To be fetched using the given product’s API Key.

.authentication(auth: MoveAuth)

SDK Authentication

Passing the authentication config is required for each initialization. The host app is also responsible for monitoring the auth state changes.

Timeline detection services

.timelineServices(vararg modes: TimelineDetectionService)

Driving services

.drivingServices(vararg modes: DrivingService)

Other services

.otherServices(vararg modes: OtherService)

Initialization listener

Block that gets invoked on initialization completion with error. On error, MoveConfigurationError is returned. On success, the MoveSdkState will change accordingly.

.initialization(listener: MoveInitializeListener)

Auth state listener

Provide a block to be invoked every time MoveAuthState changes.

fun authStateUpdateListener(callback: AuthStateUpdateListener)

Authentication Expiry

The host app is expected to monitor MoveAuthState updates viaauthStateUpdateListener(Android / iOS) API and handle those changes accordingly.

Check Authentication updates and expiry for more details about authentication expiry and renewal.

MoveSdk State listener

Provide a block to be invoked every time MoveSdkState changes.

The host app is expected to be monitoring MoveSdkState changes so it can start the SDK services when MoveSdkState is.readyor handle errors if occurred.

.sdkStateListener(listener: MoveSdkStateListener)

Trip state listener

.tripStateListener(listener: MoveTripStateListener)

Trip notifications

Passes a notification builder which is used to create a notification while on an active trip. For more information on that please check notification management.

.tripNotification(notification: Notification.Builder)

Recognition notifications

Passes a notification builder which is used to create notification while detecting activities, trips and more. For more information on that, please check notification management.

.recognitionNotification(notification: Notification.Builder)

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)

Metadata

Host apps can use this API to add any app-level information (for ex. bluetooth beacon detected, foreground/background time, etc) to append to a trip as metadata. This metadata will be forwarded back along with the trip when fetched by the client-server, so the host app can utilize it in its app. Note: The SDK will not use this metadata element in any way, it is just passed through to the product.

The block provides the trip's start and stop times. Make sure to only include metadata events that are collected inside the given start and end periods.

.metadataProvider(provider: TripMetadataProvider)

Initialization

Tries to initialize the SDK based on the given configuration. You can only have one initialized MoveSdk at a time. If you have a MoveSDK instance already, consider calling shutdownbefore. The initialization process is asynchronous and the host app is expected to register a MoveSDKState listener to monitor successful initialization and start services when MoveSdkState transits toREADY . The host app should also monitor initialization listener to handle potential MoveConfigurationError.

Application Context

Make sure to pass the application context

fun init(context: Context): MoveSdk

If you have already successfull initialized the MOVE SDK once, try to initialize the SDK next time in your application in onCreate. This ensures that the SDK can do its work whenever the application is restarted after termination.

Last updated