I'm using the Google sample app code for bluetooth communication http://developer.android.com/guide/topics/connectivity/bluetooth.html
And it works perfectly well for small chunks of data.
However, I'm trying to transmit an Bitmap encoded as a Base64 encoded string and when the data arrives on the receiving device even though it is the correct number of bytes it is frequently out of order. The buffers arrive at ~1024 byte chunks and I'm feeding them in in one write to the inputStream but when all's said and done the file frequently has chunks out of order and is subsequently totally corrupted.
I'm not seeing anyone else complain about this (here on Stack) so I must be doing something wrong, but I'm using mostly the boilerplate code from the sample and it *does work reliably for individual messages that are less than 1024bytes.
I'm wondering if there's any place obvious I should be looking to make sure that the messages are sent in the order in which they're read by the stream.