notificationFlow

abstract suspend fun notificationFlow(): Flow<SensorNotification>

Return

Flow of sensor notifications.

Usage

To start receiving notifications use collect.

To end receiving notifications use cancel on the scope it's launched in.

To handle exceptions use catch or surround flow with try/catch

val job = scope.launch {
SensorNotifications.notificationFlow()
.catch { e -> log("Exception during collecting notifications", e) }
.collect { data -> process(data) }
}
job.cancel()