Android Question Large Data Transfer over Bluetooth SPP

Gavin O'Connor

Licensed User
We have an application where we need to download a fairly large amount of data (0.5-5MB) via BlueTooth serial (from an embedded device (STM32), via an RN-41 or similar, to the Android app). Using the BlueTooth Chat example as a basis, we are finding that astreams_Error gets called somewhere during the download (with an error "Connection Reset by Peer"), resulting in the connection being dropped.

  • Adding "breathers' (delays / breaks) in the data transmission from the embedded device seems to help, but is not a reliable / consistent method.
  • A request/acknowledgement scheme (where every few bytes of data are acknowledged before further data is transmitted) works, but is painfully slow.

Any tips/ideas for an application architecture to handle this scenario, in order to get the data transferred over both reliably and as quickly as possible, would be appreciated!


B4X founder
Staff member
Licensed User
Longtime User
I assume that you are not initializing astreams in prefix mode.

Worth making a test and sending the data between two Android devices. See whether it works better. In the older days of Android there were many devices with unstable Bluetooth. I don't think that this is still the case. My guess is that the problem is in the embedded device.
Upvote 0