observeConnectionState

Observes changes to the connection state with modules.

Continues to emit values even after disconnecting or connecting to different modules. You might want to subscribe to connection state before performing any other operations:

val cmSdk = CmSdkBuilder.getInstance(context)
launch {
cmSdk.observeConnectionState().collect {
// handle connection state
}
}
cmSdk.connect("serial", "privateKey")
cmSdk.disconnect()

Return

A Flow of CmConnectionState indicating the current connection state.

See also