I've developed a Bluetooth packet protocol, any application that wants to be used on a wide enough variety of devices, and use Bluetooth on an Android platform, should take the following under consideration:
- First, my stack overflow question... about an IllegalMonitorStateException, This one was a bugger, I've added a toast to the user to restart the phone.
- Second, to my surprise there are different buffering implementations, for example, on the same LG phone, in the first few packets arriving, the first ~150 bytes are ZEROs, no data... probably due to the fact that a connection has just been established.
This problem happens when calling one of the read(...) methods which does NOT block, surprisingly calling repeatably to read(), which DOES block, would result in the correct buffer.
- Here is yet another problem I'm facing, hopefully this will be solvable...
- 08/06/2012, I've encountered another issue with the Bluetooth socket on an other Android device, once the Bluetooth connection is terminated.
On some devices the next byte read() from the stream returns -1, instead of throwing a IOException.
Will keep it coming as I go...
Sites with good invaluable information: