The Android MOVE SDK must be initialized by adding MoveSdk.init() at the first line in your Android Application class (onCreate). This instance can then be used to control MOVE SDK services. Check for more details.
After the MOVE SDK has been initialized you also want to add notifications, listeners or activate additional features.
Also you have to configure the MOVE SDK before you are able to call .setup(...).
In order to successfully initialize and run the MOVE SDK, the user's must already be fetched (), and the required must be granted. If the provided is invalid, the MOVE SDK will not initialize. If the required permissions are missing, the MOVE SDK will initialize but go into missing permission error .
The initialization of the MOVE SDK is asynchronous and you will be notified regarding state changes with the . On successful initialization the changes to READY.
To be able to use the MOVE SDK, several permission need to be granted. This is described in .
Now that there is an instance of the MOVE SDK, the detection may be started with , which should lead to an RUNNING state of the MOVE SDK.
The MOVE SDK is collecting data only when inRUNNINGstate.
Code example
// in your application class
override fun onCreate() {
// init the MOVE SDK
val moveSdk = MoveSdk.init(this)
super.onCreate()
// Example of adding some notifications, register listener
// and activate MOVE SDK features.
moveSdk.apply {
recognitionNotification(recognitionNotification)
tripNotification(drivingNotification)
sdkStateListener(sdkStateListener)
tripStateListener(tripStateListener)
authStateUpdateListener(authStateListener)
initializationListener(initListener)
initiateAssistanceCall(assistanceListener)
consoleLogging(true)
}
...
// Configuration of the MOVE SDK
val moveServices: MutableSet<MoveDetectionService> = mutableSetOf()
val drivingServices: MutableSet<DrivingService> = mutableSetOf()
drivingServices.add(DrivingService.DrivingBehaviour)
drivingServices.add(DrivingService.DistractionFreeDriving)
val walkingServices: MutableSet<WalkingService> = mutableSetOf()
walkingServices.add(WalkingService.Location)
moveServices.add(MoveDetectionService.Driving(drivingServices = drivingServices.toList()))
moveServices.add(MoveDetectionService.Walking(walkingServices = walkingServices.toList()))
moveServices.add(MoveDetectionService.Cycling)
moveServices.add(MoveDetectionService.AutomaticImpactDetection)
moveServices.add(MoveDetectionService.AssistanceCall)
val moveConfig = MoveConfig(moveDetectionServices = moveServices.toList())
...
MoveAuth(
projectId = projectId ?: 0L,
userId = userId ?: "",
accessToken = accessToken ?: "",
refreshToken = refreshToken ?: ""
)
...
moveSdk.setup(
auth = auth,
config = moveConfig,
start = false,
motionPermissionRequired = true
)
}
You need to replace projectId, userId, accessToken, and refreshToken with your own values.