BluetoothSerial icon indicating copy to clipboard operation
BluetoothSerial copied to clipboard

Some data received is wrong in Android 8.0

Open terryli0925 opened this issue 6 years ago • 0 comments

My app receive approximately 160k bytes of data from connected device. It work normal in Android 7.0 and below, but some data (approximately 2k bytes) received is wrong in Android 8.0. The failure rate is 80%. After I test, I found the wrong data has occurred in BluetoothSerialService.java.

bytes = mmInStream.read(buffer);    // Get wrong data in buffer
String data = new String(buffer, 0, bytes);

I also try increase buffer size or add some delay after read, but it's useless. I'm sure the data send from device is correct. Please help me to figure out what happened or how to handle this. Thanks.

terryli0925 avatar Jul 31 '18 01:07 terryli0925