Android serial comms using thread, handler, kotlin flows, suspend functions and compose
I’m trying to write an Android app which requires some serial comms with a bluetooth device. Some of this comms is command/response and some of it is event data that just gets sent from the device. All of it is packetized with packet type identifiers. I’ve setup a bluetooth serial thread which handles bluetoothSocket input/output streams. I can create command packets and send them. The thread takes a Handler as an arguement and sends messages to the main thread when a complete data packet is received (a handful of bytes in a ByteArray).
How to convert the data without collecting the flow?
I’m trying to convert the data I read from a repo class inside a ViewModel like this:
How to convert the data without collecting the flow?
I’m trying to convert the data I read from a repo class inside a ViewModel like this:
How do you cancel collection and/or onEach for a Kotlin coroutine Flow
I have the following common code for “subscribing” to a Kotlin coroutine Flow that is used throughout my Android application…
How do you cancel collection and/or onEach for a Kotlin coroutine Flow
I have the following common code for “subscribing” to a Kotlin coroutine Flow that is used throughout my Android application…
Datastore flow stuck
I’m looking to read my DataStore for Feature Flags I have saved there. DataStore returns a flow, which makes sense but I do really need to read it once at the moment. No fancy logic. Listening to live changes is less important right now but might be in the future.
Is it recommended to implement StateFlow in a Custom Kotlin Flow class
I want to create a Custom Flow class which should be a Hot Flow. So it recommended to create something like below
Resume Kotlin Coroutines Flow from inside a Flow
I have a function like this:
Kotlin callback-based apis with more than one method
I have a use case called “RegisterDeviceUseCase” with a function “execute()”.
I want this function to call a bluetooth adapter to get some information from the peripheral, and with the result, call a rest api and make execute() return the result from the rest call.