October 7th, 2019

Our journey to making Android Bluetooth "Behave"

Most people who enter the Bluetooth APIs with Android devices immediately get quite flustered at how hard it is. However, physical android devices are a larger nightmare.

Max Alexander

Max Alexander

CPO and CoFounder of Ditto

When Tom, our resident network expert, embarked on creating a cross-platform Bluetooth stack, he noticed that while the APIs were relatively similar to comparable platforms, they didn't behave the same. In particular, he noticed incredibly different behaviors even with phones on the same exact Android operating system.

For example, Google Pixel phones could tell the operating system that they've disconnected while at the same time still recieve packets of data. In addition, all Android 9 phones also exhibited randomized failure of the entire Bluetooth stack. Since Ditto is primarily building a stream API on top of various operating system, it needs some uniform interface that promised to behave the same. However, we realized that we will need to constantly monitor different devices for unstable APIs, and write adapters, to "coerce" them to work with our streaming API.

Shameless plug (well you're on the company website 😉), I highly recommend that you avoid the Android Bluetooth stack at all costs and just use Ditto instead. The vast majority advisors and companies we've talk to simply have given up on the matter entirely. But as Tom has demonstrated, if you use Ditto you'll have taken our extensive experience in standardizing Android's Bluetooth stack without the headaches that you will run into if you decided to build it yourself.

Get posts in your inbox

Subscribe to updates and we'll send you occasional emails with posts that we think you'll like.