Getting to the bottom of the Android Bluetooth Low Energy API

07 Jul 2013

Internet of things has been trending more than ever in the tech talk of the last couple of months. Partly because of this year’s Google IO, which broke the mold and presented the new API for Bluetooth Low Energy (BLE), among other things.

Even though this technology had been around for a while, Android OS couldn’t provide native support for it. This pushed the leading manufacturers of Android-powered mobile devices, such as Motorola, Samsung and HTC to take initiative into their own hands and provide their own APIs. The downside was that developers had to deal with multiple libraries to unlock the benefits of BLE for users.

The current Android API version 18 will bridge the gap between Android mobile devices and other types of devices with Bluetooth aspirations:

  • on the one hand, Android platform supporting BLE means using a native Android API rather than a separate library for various device types, means saving developers’ effort and customers’ budget, means more applications will start using BLE technology

  • on the one hand, a new page is turned for the Internet of things, proving Bluetooth possible for devices of all sorts and sizes: smart sensors of sorts (e.g. thermometers, tonometers, heart rate monitors), alcotesters, GPS trackers, and the list goes on and on...

What BLE module means for Android

The implementation of the Android BLE API will cut down on Bluetooth energy consumption and prolong battery life, but not as much as everyone expects.

Firstly, because LBE technology is used for quite different use cases, the data model is optimised for small incremental updates with max theoretical throughput of 200kb/s (this means audio/video streaming isn’t possible). Therefore, it should be used for reading data from different sensors/markers, or for communication with the controllers.

Secondly, not all devices will support BLE (only some Samsung and Motorola devices do). Luckily for all Nexus users, it was announced on Google I/O “Best Practices of bluetooth” that Nexus 4 and all upcoming Nexus devices will support BLE.  This means that, in addition to the existing Samsung and  Motorola users that already have this technology implemented on their devices, only Nexus 4 users will enjoy the benefits of BLE support in the nearest future.

Last but not least, there’s a limitation within the new API. Its first version can only support a central role, but not peripheral. This means that you won’t be able to have 2 Android devices communicating across BLE, but you will still be able to connect multiple side peripheral devices to a single Android device.

Some implementation details

Bluetooth Low Energy option was designed to allow devices with small battery output operate for  years. The new API will be released with SDK 18 in a few months with two modifications:

  • Bluetooth smart (supporting BLE only)
  • Bluetooth smart ready (supporting classic and BLE Bluetooth)

According to the Google I/O: Best Practices of bluetooth presentation, profile discovery and description services in LBE  protocol are provided by GATT. It defines how a set of ATT  attributes are grouped together to form services.

As you can see from the Best practices of Bluetooth schemes above, BLE services contain data as Characteristic objects, containing the data itself.

Each GATT characteristic contains the value and descriptor set. 

Roles

As stated above, there will be a central role and an observer role implemented in API 18. You might ask, how about the implementation of peripheral and advertiser roles? Well, this is probably what the Android BLE team will work on further.

Calls

There will be secure and insecure API calls for Bluetooth. In case of a secure call, a request may be rejected when the client’s display is not able to show the dialog with the PIN. So for now insecure calls are the top of the list.

Goodies

AVRCP 1.3  will be included in the API, and the quite convenient RemoteControlClient will be provided.

Summary

To sum up, which new opportunities will the BLE module bring?

Firstly, as it was mentioned above, the new technology will make it easier to perform Bluetooth operations within all set of Android smartphones and other Bluetooth-oriented devices.

For the Internet of Things – technology which is buzzing around now – Bluetooth Low Energy support opens up new frontiers, too. It paves the way for IoT solutions within almost all sorts of smart devices like intelligent sensors and switches, GPS trackers, alcotesters, bringing more convenience into everyday life.

Healthcare, sports, lifestyle and technology are sectors that will benefit the most thanks to the IoT. Heart rate monitors, shoe sensors, automatic doors: interconnection between the devices will become simpler and more effective.

References

In this article we’ve quoted abstracts from the Google I/O “Best Practices of bluetooth" speech. 

Top of page image source: "Best practices for Bluetooth Development" presentation.

You can find more information on developing applications for latest IoT gadgets in our experience section Apps for Connected Devices.

About Lemberg

Lemberg is a UK mobile and web development company with strong client base in the UK, Europe, and the USA.

Starting from 2007, Lemberg has been helping leading design and marketing agencies, start-ups, innovative businesses deliver brilliant digital solutions for a number of the world’s biggest brands.

We provide our clients with impeccable services, including mobile apps creation (iPhone, iPad, Android, Windows Phone), web development (Drupal, front-end, back-end and API development), and support services.

Our goal is to go beyond clients’ expectations: as a technology partner, we take the responsibility for implementing the most ambitious, creative and innovative ideas.