All posts
Blog, iOS

5 Things You Were Wondering About Developing Bluetooth Low Energy iOS Apps

Michał Pyrka

Michał Pyrka

Is it possible for an app to handle multiple Bluetooth Low Energy devices simultaneously? Can I stream music via Bluetooth Classic to my Bluetooth speakers and communicate via BLE? Check out the answers for these and other crucial questions regarding BLE technology on iOS.

Short history of BLE

Previous versions of Bluetooth, before BLE, required a lot more energy for communication. Because of this, companies started working on a solution that would allow devices powered by a small CR2032 battery to communicate with each other. The idea was simple: let’s create a new standard for a whole range of appliances, like heart meters that can run for months and broadcast the interesting info over time, without the need to constantly querying it.

That’s how Bluetooth Low Energy was introduced in the Bluetooth 4.0 standard. It consists of 3 separate parts, but on the iOS platform we will be interested in the latter one. This is where CoreBluetooth framework comes into play.

iOS was the first major platform to leverage the power of BLE – in 2011, a set of tools was introduced along with the iPhone 4S hitting the market. This was the first iPhone that had the capability of using BLE, since this version is not backward compatible with the ‘Classic’ one (all versions before 4.0 are often referenced as Classic).

Bluetooth 4.0 BLE iOSCoreBluetooth.framework = BLE on iOS

What does this mean for developers then? Apple has done a great job of introducing the CoreBluetooth.framework – with official Bluetooth terminology and docs in mind, they created a powerful set of tools to create great apps that communicate with Bluetooth devices.

There are many features that help make a developer’s life much easier, such as simulating the Bluetooth peripheral that is still in development in your hardware department or state restoration for keeping the app alive, even when the system shuts it down for memory preservation.

Apps utilizing BLE with CoreBluetooth.framework are friendly to iOS devices’ battery, too – sending and receiving packets have little impact on power level. With each new version of the Apple System, it’s getting more and more optimized, so keep that in mind when you’re choosing which models you want to support for your app!

5 Things you might be wondering about BLE iOS apps

1. Is it possible that an app can handle multiple BLE devices simultaneously?
A: Yes! As you can see on the picture below, apps on iOS can communicate with many different devices – reading values, updating them and so on. It is not required to have all devices connected to the app at the same moment, either.

BLE iOS

2. What about audio devices work with BLE? Can I stream music via Bluetooth Classic to my Bluetooth speakers and communicate via BLE?
A: If the speakers do support BLE – of course. For instance, you can connect to them in iOS to play music and, in your app, you can read the battery level or send some specific commands, such as changing the internal equalizer.

3. Does the app work in the background? I would like to collect some data from my device even when the app is not visible on screen.
A: Yes, that’s totally doable. Furthermore, we can set the app up so that it will receive data from a device even when it was terminated by iOS to preserve the battery and memory!

4. I want to communicate with the app via Bluetooth Classic. Is this possible or can I only use BLE in iOS?
A: You can communicate via Bluetooth Classic, but it your device requires certification from Apple. For more info, check the link.

5. Can I test my device on iOS somehow, to see how it behaves, or should I develop the app first?
A: There are apps that allow you to send commands and listen for notifications, such as LightBlue. Alternatively, you might want to create a separate module for BLE communications to test and validate them quickly, rather than having a complete app UI.

Wrap up

BLE capabilities on iOS are very broad – an app can restore connections, handle many connections at once and can utilize the very concise and easy-to-get-to API of the CoreBluetooth framework. Furthermore, the Bluetooth module in Apple devices is really stable, so you should not notice connection drops often.

As you can see, creating apps on iOS with BLE looks attractive – but it’s not trivial. Still, gathering a group of experienced engineers with CoreBluetooth experience might make it far more simpler and quicker.

Newsletter

The post is created by Droids On Roids Team Member.
We would love to take care of your business.

Leave comment