Lilly
09/10/2021, 12:16 AMchannelFlow
that stops sending to collector after some time and I can't figure out why:
override fun readByteArrayStream(): Flow<ByteArray> = channelFlow {
try {
requireNotNull(bluetoothSocket) { "Bluetooth socket is null. Connection has been closed." }
val inputStream = bluetoothSocket!!.inputStream
val buffer = ByteArray(1024)
while (isActive) {
val numBytes = inputStream.read(buffer)
val readBytes = buffer.copyOf(numBytes)
Log.d("Reading", "$readBytes")
send(readBytes)
}
} catch (e: Exception) {
Log.e("Error", "error: ${e.message}")
}
}.flowOn(<http://Dispatchers.IO|Dispatchers.IO>)
It's still logging so the flow didn't stop. Any ideas?radityagumay
09/10/2021, 12:24 AMLilly
09/10/2021, 12:29 AMflow
builderJohnjake Talledo
09/10/2021, 4:16 AMval inputStream = bluetoothSocket!!.inputStream
having a null valueLilly
09/10/2021, 8:33 AMradityagumay
09/28/2021, 12:02 AMLilly
09/28/2021, 11:50 AMradityagumay
09/29/2021, 12:00 AM