The actual, full implementation in the context of an example app is available as an open source GitHub repo. Most code snippets were written in Kotlin, but they translate well over to Java too.Īll the code snippets in this post aim to showcase how a given BLE operation should be performed. In this post, we’ll go over the basics of BLE that Android developers need to know, as well as walk through some simple yet real-world examples of performing common BLE operations on Android like scanning, connecting, reading, writing and setting up indications or notifications.
Unfortunately, the Android SDK’s BLE API is full of undocumented pitfalls and leaves a lot to be desired despite the platform commanding over 76% of market share worldwide.įret not, as the Punch Through team has learned a lot over the years working on BLE connected Android apps, and we’re here to share our experiences and lessons we’ve learned with our readers!įor new readers not familiar with who we are and what we do, we are Punch Through: an engineering consulting firm specializing in firmware, software mobile, and hardware solutions that help engineering leaders and teams through the complex journey of building a Bluetooth product. With its ability to consume very little power yet still provide the connectivity to communicate with small devices, more and more people are looking to hop on the Bluetooth Low Energy (BLE) bandwagon for Android apps.