I spent three hours trying to reconnect a mobile app to my vacuum cleaner the other day. It took that long because I had to pair the app with the appliance over WiFi instead of Bluetooth Low Energy (BLE).
Imagine if it was a healthcare gadget.
Fortunately, BLE is gradually becoming the golden standard in healthcare, retail, and other industries. So we’re less likely to waste time on something that’s designed to work out of the box.
In this blog, we’ll share tips and tricks on how to create an app with Bluetooth Low Energy. It’s dedicated to people striving to make everybody’s lives easier by leveraging this coming-of-age technology.
Table of contents:
- What is BLE?
- Advantages of Bluetooth Low Energy
- Areas of BLE Technology Application
- Create an App with Bluetooth Low Energy Technology in 5 Steps
- Tips on BLE app development
- Our Experience in Bluetooth LE Application Development
What is BLE?
BLE stands for Bluetooth Low Energy. It’s a wireless radio technology for interconnecting various devices and allowing them to exchange data.
If you’ve ever used wireless headphones like AirPods, you’re already familiar with BLE’s bigger brother — Bluetooth. The Low Energy part has to do with optimized performance for longer battery life, meaning BLE devices transfer less data and (typically) operate at a shorter range compared to classic Bluetooth.
In the custom app development world, Bluetooth LE is how a mobile app connects to external peripherals, let’s say, a heart rate monitor or fitness tracker. Besides that, BLE is also how a proximity sensor transmits data to all nearby BLE-enabled applications.
Advantages of Bluetooth Low Energy
Why do businesses use BLE at all? Why not WiFi/4G/5G? Well, Bluetooth LE is better at close ranges because it’s often faster and cheaper than alternatives.
When you need to exchange data with a nearby device, it’s faster to connect with it directly (peer-to-peer), as opposed to setting up other connections requiring a server and more expensive hardware. That’s especially true when you’re controlling a Bluetooth Low Energy device and expect an immediate response.
Other upsides of the BLE technology include:
- automatic notifications when data on a BLE device changes
- if there’s no data to send, you don’t need to send any data (longer battery life)
- easy pairing for end-users
Areas of BLE Technology Application
As you’re well aware, data is everything for businesses that want to outpace competitors. And if data coming from IoT devices gives you this edge, then Bluetooth Low Energy app development should be your priority.
Related Article: How to Create an IoT App
BLE apps help control all sorts of sensors and IoT devices in various industries. You’ll most likely need such a Bluetooth LE app if you run a business in one of these areas:
- Home automation
So why would you develop a BLE app for healthcare, for example? There are several major use cases to choose from:
Data transfer. That’s the most common use case: imagine you have a glucose meter that patients use at home, and they need an app to read data from this sensor on their mobile phones.
Location tracking. Somewhat of a novelty use case that’s great to impress customers and provide them with an added value of easily navigating inside your clinic.
In this scenario, a BLE app interacts with special trackers (beacons) and can accurately track user location inside buildings.
Audio streaming. A nascent technology (for BLE!), improving audio streaming immensely without compromising the battery life of streaming gadgets and earbuds. Imagine a patient listening to the heartbeat of her newborn and at the same time speaking with their other half (because of the new LC3 codec with support for multi-stream). Or a patient, enjoying all the benefits of the BLE technology using her hearing aid.
You May Also be Interested: How to Develop a Streaming App
Mesh networking. Similar to location tracking use cases, but instead you track medical equipment and have many sensors talking to each other. A Bluetooth LE app that controls a mesh networking platform could allow a clinic to optimize its use of lights too.
Create an App with Bluetooth Low Energy Technology in 5 Steps
If you’ve read any of our app development blogs, you already know the main phases of app development. For those unfamiliar, the drill is hardly a surprise:
- Prototyping & UX/UI design
Still, let’s discuss the small things that characterize BLE application development during each development phase.
Step 1: Design considerations
Like with any niche mobile app, BLE application design has its peculiarities. What are some of the things you will need to consider when designing a BLE app?
First things first: we need to onboard new users. Since they need to connect the app to an external device, a blitz video instruction would make a lot of sense. Believe me, both your customers and support staff will be happy you did this.
Besides onboarding, you need to remember these things that may aggravate user experience if not addressed:
- Clear indication of what’s happening in the app
Since Bluetooth Low Energy-enabled apps seriously rely on connectivity, the user should always be able to immediately see whether an app is connected or not, whether it’s trying to connect at the moment, or if any user action is required.
- Graceful error handling
In a nutshell, we should only show errors that make sense to the user while trying to figure out everything else, e.g., reconnecting, in the background.
- An explainer screen with instructions when Bluetooth is turned off and the app can no longer operate.
An extra mile would be surfacing a button that brings up the default Bluetooth dialog so users can quickly turn it on.
- Have minimal settings
Dealing with new hardware and software at the same time can be challenging. So making users’ lives easier by removing unnecessary clutter would definitely pay off.
Step 2: Web app to rule them all
While not a hard-set requirement, you can still enhance your BLE-enabled infrastructure by developing a web admin portal. “Wait? To build a BLE app, I need a web app?” That’s right.
This web application will be useful for updating firmware on all your Bluetooth LE gadgets at once. Just in case, the firmware is like a miniature OS running on hardware and controlling its operations. We update it to keep BLE devices secure and fresh with new features (previously postponed for faster time to market).
You may also use the web application to locate the equipment and monitor its status. Of course, building such a web portal is recommended when you need to administer a large fleet of Bluetooth LE devices.
Step 3: Coding and hardware considerations
This step will take the most time and effort. To streamline coding, you’ll need to settle a few things before you create a BLE app.
Decide on the hardware you will be using. Your choice of hardware will guide some of the most critical aspects of BLE app development:
- Will the BLE app support the iPhone’s proximity-sensing capabilities?
- Will you be able to set up a long-range connection (some chips up to 5000 ft)?
- Will you be able to send all required data given the hardware’s throughput?
These and many other features of your BLE mobile solution will depend exclusively on hardware.
Choose applicable BLE libraries so you don’t have to start from scratch. Some the popular libraries include:
The choice will depend on the mobile OS for which you want to make a BLE app. And by the way, Eddystone is no longer relevant because Google is shutting down the project.
Implement security BLE recommendations by the Bluetooth SIG. The Bluetooth Special Interest Group advises to follow these security best practices when you build an app with BLE support:
- Use LE Security Mode 1 Level 4
- Use private resolvable addresses to protect your users’ privacy
- Protect data on a sensor with access, encryption, and authentication permissions
You can glean more from their extensive guide on Bluetooth LE security.
Step 4: Testing like a pro
One of the most challenging BLE app development tasks is testing a BLE application when a hardware chip is not yet ready. In this case, you should use a BLE dongle that connects to a laptop or simulator apps like LightBlue or Nordic nRF Connect.
Otherwise, you’re stuck with manual testing, and only if you happen to build a BLE app on Flutter, there’s an open-source emulator BLEmulator.
Step 5: Deployment
What you need to know about delivering your BLE apps to consumers is that if your app is for internal use only, you will need to distribute it using Apple’s Ad Hoc or Enterprise distribution model. That is, you’ll be able to specify devices authorized for use with this BLE application.
No shenanigans are necessary in the Android world: you can upload your app to your site or email it straight to employees.
Tips on BLE app development
Let us share some of the BLE application development best practices that we’ve accumulated while working on healthcare BLE apps.
- Scan only until you find the desired device and don’t use looped scanning
- Set up your Bluetooth LE app to ask to be notified when a device has new data
- Scan using filters to find the desired device quicker (by manufacturer ID or profile, e.g., “find all heart rate monitors”)
- Introduce app-layer security to protect the data flowing between devices and a BLE app
- Setup the optimal size for transferring data to/from a BLE device
Bluetooth LE Android apps
Android BLE app development has its quirks:
- Use Android API level 21 or newer (Android 5.0+)
- Avoid using private APIs (as they will not work on Android 9+)
- Educate users before asking them about Bluetooth permissions
Bluetooth LE iOS apps
Apple takes a more careful approach managing a lot of Bluetooth connectivity stuff on the OS level. Still, there are a few things to keep in mind if you want to create a BLE app for the iPhone.
- as long as you stick with the Core Bluetooth framework, operations queuing will be handled by iOS automatically
- use Core Bluetooth’s background processing and state restoration APIs to make the connection to Bluetooth LE sensors more reliable
- use the iBeacon technology to add (hyperlocal) location awareness to your BLE app
Our Experience in Bluetooth LE Application Development
We’ve built a dozen BLE-enabled apps, most of them for healthcare providers to help them:
run medical research:
- iFaint, a remote patient monitoring app for the Stanford University School of Medicine
operate healthcare sensors:
- DermaSensor, skin cancer detection scanner
enhance remote patient monitoring experiences:
- remote patient monitoring app for Tula Health, leveraging data from glucometers
Other examples of BLE apps we built help people count steps and control home appliances.
One of the recent projects where our BLE app experts had a chance to chew over BLE implementation was a light-therapy app. We had to maintain compatibility with the client’s legacy light-therapy devices while adding support for their latest hardware.
Ultimately, we had to recover the BLE commands from a legacy codebase and apply them in a clean new code. As a result, the app began to support new hardware with more features, using the full potential of BLE connectivity while preserving support for older devices.
If you have any questions about BLE application development, schedule a meeting, and one of our app wizards will guide you through all the intricacies.
Frequently Asked Questions
How much data can you transfer over a BLE network?
Up to 2 Mbps, but it depends on the hardware. The actual chunk of data will be smaller because of the overhead meta-data necessary for the Bluetooth protocol. In practice, most sensors operate under the 512-byte threshold.
Do I need to check if my BLE device ships with some SDK or API to pair it successfully with my application? Or what do I need?
You just need to check if the device is following Bluetooth specifications and what version.
What is the real range for BLE?
Most recently up to 5000 ft. in direct line-of-sight scenarios. However, more ubiquitous use cases vary from 3 to 33 ft.
Do cross platform apps (for example, ones developed with React Native) work with BLE?
Yes, there are even ready libraries available to help you make a BLE app faster.
Does the user need to connect with in-store beacons before interacting with them?
No, and many users can receive info from the same beacon simultaneously.
Can a BLE device connect to more than one phone at the same time?
No. If a phone (with a corresponding BLE app installed) is used to control the device, the latter can interact only with one mobile phone (app) at a time. It’s different from BLE beacons because beacons transmit data available for all phones (applications) in the vicinity. At the same time, a Bluetooth LE app can connect to many peripheral devices simultaneously.
Is iOS BLE app development simpler than making Android BLE apps?
To some extent, yes. But with Android, you get more flexibility.