sdkState

abstract val sdkState: StateFlow<SdkState>

A StateFlow representing the current state of the SDK

Collect this flow to observe state changes.

Custom implementation of StateFlow guarantees all changes to be notify - no conflation.

Example:

val initParams = InitParams.Builder(this, BuildConfig.API_KEY).build()
NavigationApi.init(initParams)
lifecycleScope.launch {
NavigationApi.sdkState.collect { state ->
when(state) {
is SdkState.Disposed -> { /* SDK not started yet */}
is SdkState.Disposing -> { /* In the process of disposing */}
is SdkState.Initializing -> { /* In the process of initializing */}
is SdkState.Authenticating -> { /* This state can be reached after Initialized state because of periodic authentication check. */}
is SdkState.Initialized -> { /* SDK is initialized and ready for use */}
}
}
}

See also