I am making Bluetooth socket connection to Bluetooth device and want to read bytes from the device.
I have established connection correctly :
try {
Method m = mmDevice.getClass().getMethod("createRfcommSocket", new Class[] { int.class });
temp = (BluetoothSocket) m.invoke(mmDevice, 1);
} catch (Exception e) {
}
I am reading bytes correctly from Bluetooth device.
I am getting the exception :
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
Due to this, the connection is broken and the communication is also over between my device and Bluetooth device.
This problem is coming on Android 5.0.1 Lollipop especially
Can anyone have workaround ?