MoveSDKState

Represent the different SDK States.

sealed class MoveSdkState {
    Uninitialised()
    Ready()
    Running()
    Error(reason: MoveStateError)
}


MoveStateError { 
    LocationPermissionMissing
    PhonePermissionMissing
    OverlayPermissionMissing
    MotionPermissionMissing;
    
    fun resolved()
}

Note: In case of resolving an error, the SDK needs to be notified via resolved() method of the state-error object.

Upon initializing the SDK, it will evaluate the system's services and required permissions (for Android / iOS) to activate the SDK detection services requested by the host app in the passed MoveConfig. The SDK is successfully ready to start its services only if all the required services are available and all the required permissions are granted. The SDK will not transit to .ready MoveSDKState except when all its requirements are fulfilled.

Required and optional permissions are determined based on the passed MoveConfig on initialization. Check MoveConfig and permissions handling (Android / iOS) for more details about configurations and permission requirements.

The host app is expected to monitor MoveSDKState changes via setSDKStateListener to handle the MoveSDKState transitions accordingly.

When the SDK transits to an error state, it either will be a:

  • Permission error: In this case, the host app is expected to handle this missing permission (for Android / iOS) in its app accordingly. When the missing required permission is granted, the SDK will transit back to .ready MoveSDKState waiting to start.

  • MoveAuth Expired: In this case, the host app is expected to fetch a new MoveAuth from the SDK server to renew the session.

Last updated