How to Integrate BLE-Based Fitness Devices into your App

Published: June 3, 2024

21 min read

Daniil Rostrypa

Daniil Rostrypa

Rockstar Copywriter @ Stormotion

Anastasiia Chala

Anastasiia Chala

Rockstar Copywriter @ Stormotion

Andrian Yarotskyi

Andrian Yarotskyi

Developer @ Stormotion

Smart fitness devices became users’ best friends after the COVID-19 pandemic boosted the switch of the world to remote working, studying, negotiating, you name it. Fitness wasn’t an exception and a lot of people started working out using various smart devices combined with an application.

January typically witnesses a seasonal spike in downloads of fitness and workout mobile applications. According to Statista, in January 2020, there were approximately 16.3 million downloads of top fitness and workout apps, marking an impressive 80 percent surge from the previous year.

However, the trend seems to have stabilized in the last two years, with downloads of these popular mobile fitness apps showing a slower rate of growth. In January 2024, the foremost mobile fitness and workout apps registered nearly 14 million downloads globally, reflecting trends in the fitness app retention rate.

Companies had to dynamically adjust to current market needs and offer users a solution. For a lot of companies, the solution was a BLE-based fitness device paired up with a dedicated app.

BLE fitness integration with an iOS or Android app can offer each client butter user experience

Bluetooth Low Energy can support you on your way to providing each client with an innovative solution (image by MoRas ✪)

Here comes the question of what stays behind the scenes — how can BLE integration work with your app? Surely, the technical side isn’t something you have to perfectly understand as the provider unless you are the person who performs the integration.

Yet, our goal is to give you just about enough knowledge to be on the same page with the tech guys talking about BLE integration. Surely, we’ll also talk about enabling communication between BLE fitness devices and your app.

Additionally, we’ll look at some fascinating BLE-based fitness device use cases, give you insights on how to simultaneously connect several devices, and share our experience in the integration process for the projects in the fitness industry that Stormotion’s worked on.

Enjoy! 🚀

🤖 BLE Integration: Relevant Tech Stack Basics

According to Bluetooth Special Interest Group (SIG), Bluetooth Low Energy is a wireless technology that’s used for connecting two or more nearby devices so they can communicate (exchange data, for the most part). The three keywords that describe BLE are power efficiency, high battery longevity, and rapid connection.

Good to know but not a must: Bluetooth Low Energy (BLE, Bluetooth Smart, Bluetooth LE) is a part of the Bluetooth Core Specification 4.0 — a specification that defines technologies needed to build devices that are based on various BLE technologies.

The BLE-based devices are extremely popular in the fitness industry exactly for these qualities — they enable companies to provide their customers with convenient solutions for wellness app development that require very little maintenance and zero technical knowledge to pair up with users’ devices.

Let’s start with some technical details. Firstly, the data transfer between two BLE-enabled devices is regulated by GATT. It stands for Generic ATTribute Profile and defines that two devices with an exclusive connection communicate using the Services and Characteristics concepts. Take a look at the following scheme and we’ll unpack it right after:

BLE devices have Server and Client relationships where each separate BLE device or smartphone can play both roles

Each BLE device can be a Server and/or a Client (shots from O’Reilly)

  • GATT Server is divided into several services. For example, there can be a Blood Pressure Server that consists of several services.
  • Services divide the data into blocks (Characteristics) that are logically needed to provide a specific service. For the Blood Pressure Server, the services are Blood Pressure Service and Device Information Service.
  • Characteristics are basically containers with data points and certain values. The_ Blood Pressure Service_ displays such units as Intermediate Cuff Pressure, Blood Pressure Measurement, and Blood Pressure Feature. The Device Information Service — Manufacturer Name String, Hardware Revision String, and Model Number String. A string is text information.
  • Descriptors provide additional information about characteristics and their value.

Here’s a table that demonstrates the hierarchy of the GATT:

Server

Blood Pressure

Services

Blood Pressure Service

Device Information Service

Characteristics

Intermediate Cuff Pressure

Blood Pressure Measurement

Blood Pressure Feature

Manufacturer Name String

Hardware Revision String

Model Number String

...

For businesses in the fitness industry, it’s important to understand this concept so they’re able to break up their own services into single data flow blocks.

Another essential part is the difference between central and peripheral devices. To begin with, central devices are the ones that initiate the connection, peripheral accept the responses. A central BLE device can be connected to multiple peripheral devices at the same time.

For peripheral devices, it’s the opposite — they can only be connected to one central device at a time. For example, your user’s phone (central) can be connected to a fitness band, a heart rate ring, and smart dumbbells (peripherals) simultaneously, while each one of these devices can be connected to a single iOS or Android device.

Bluetooth Low Energy can allow a client to control Bluetooth devices using your iOS or Android app on their smartphone

Each specific device can be a peripheral or central device (image by Adafruit)

However, these are only some general rules. With a proper configuration, a device can be both at the same time, which enables peripheral devices to several connections to different central devices. Plus, the number of connections is technically unlimited, but in practice, there’s always a certain limit. For example, 20 connections are something totally reachable.

There are also such terms as GATT Client and Server, that are often compared with central and peripheral roles, but these are dissimilar concepts. The difference is that client and server terms refer to how the data flow and storage are managed, while central and peripheral roles define the connectivity structure.

The Client/Server relationship itself is pretty simple. Client devices access the data, while Servers are responsible for storing and providing access.

BLE connectivity capabilities can be further extended and enhanced with the
Mesh Bluetooth technology. It enables devices to form a mesh network, allowing them to communicate with each other over longer distances by relaying messages through intermediate nodes.

Bluetooth SIG defines that even if a device is out of direct range of a central device, it can still communicate as long as there’re other devices within range to relay the message.

An example of the fitness app’s functionality

BLE-based fitness trackers allow users to monitor their health metrics inside the app (image by Rupak Chakraborty)

Mesh technology can be also implemented in fitness apps paired with BLE-enabled devices, such as heart rate sensors, smart scales, and exercise equipment. This allows for seamless data synchronization, higher transmission power, and analysis across multiple devices, enhancing the user experience and enabling more comprehensive fitness tracking.

If you’d like to learn more technical details about Bluetooth technology and BLE intergrations, feel free to follow the link to our article fully dedicated to BLE devices:

💼 Bluetooth, BLE & Fitness Industry Use Cases

Most likely, if you’re exploring BLE-based fitness device integration for corporate fitness app development, you already understand the advantages of Bluetooth Low Energy over other wireless networks. However, there’s this network that always gets compared to BLE and is its ancestor — Bluetooth Classic or simply good old Bluetooth.

So, to better highlight the features of the BLE, let’s briefly discuss the main differences between these 2 networks. After that, we’ll give you a couple of fascinating BLE use cases in the fitness industry. You might get some inspiration for your own business or figure out what’s something you would avoid.

Feel free to skip this section if that’s something you believe you’re perfectly aware of.

BLE vs Classic Bluetooth

Since we’ve already talked about what BLE is, let’s briefly talk about Bluetooth Classic. It’s also a wireless network that establishes a connection between 2 Bluetooth devices (think about wireless earphones or speakers). Its main function is exchanging big amounts of data at close distances.

Bluetooth devices can be connected to a smartphone directly - you don’t really need an iOS or Android app for that

It’s pretty reasonable to compare Bluetooth Low Energy and Classic Bluetooth as they have pretty different use cases (image by Andrew Rosek)

The main significant Bluetooth vs BLE difference is that BLE is designed for smaller amounts of data transfers with lower battery consumption. The battery service in BLE fitness devices can last for years. Thus, this option is much cheaper, compared to building Bluetooth-based devices. Bluetooth, on the contrary, is more pricey because it works with “heavier” data and requires more maintenance in terms of battery level.

Because of this difference, Bluetooth Low Energy is much more widespread in the fitness industry. It allows companies to provide their customers with user-friendly ready-to-use devices at a relatively low cost.

The Bluetooth SIG predicts that shipments of single-mode BLE devices will reach 1.8 billion in 2024 and double over the next five years. Looking ahead to 2028, it's anticipated that 97 percent of all Bluetooth devices will incorporate Bluetooth Low Energy (LE), encompassing both single-mode LE and dual-mode Classic + LE devices.

Another important difference is that Bluetooth Classic has an active connection for a limited period of time (from a couple of seconds to several hours). BLE, on the other hand, has a continuous connection in sleep mode, which is the main reason for considerably reduced power consumption. Now, let’s take a look at how BLE integrations can be used in the fitness industry.

Bluetooth Low Energy Uses Cases in the Fitness Industry

Fitness bands and smartwatches are something that most of us know, have, or regularly use — this is one of the most widespread BLE integration use cases. However, the industry, including when you develop a mental health app, goes far beyond that and embraces a lot of fascinating IoT (Internet of Things) technologies. Now, a BLE device acting as a bridge between the physical object and the digital world enables seamless communication and data exchange.

You can also think about this section as getting to know your potential partners. If a company offers a device that you’re interested in, you can always contact them and ask if they have any partnership opportunities in terms of providing their hardware and/or API (we’ll talk about what API is later in this article).

Smart Mats

BLE-based smart mats for exercise and yoga are able to analyze posture and exercise positions, provide users with recommendations on how to improve them, count the repetition of the exercise, keep a record of workouts to overview progress, etc.

Such devices are normally controlled by a client using a dedicated iOS or Android app on their smartphone

Even a regular smartphone nowadays has an integrated Bluetooth Low Energy module so you simply have to build an app to enable each client to control such devices (image by ARI)

When it comes to providers of such mats, the market is full of them: YogiFi, SmartMat, Otari, and many others. The basic functionality is pretty much the same, but some providers offer additional features that surely increase costs. Otari, for example, has an AI-based camera that oversees people while exercising in real-time and provides voice-based instructions.

If you’d like to learn more about building yoga applications, we have an article about it, where we review the whole development process in detail:

Smart Glasses & Traning for Olympics

There’s a start-up called Solos that offers smart glasses to their customers. Solos glasses were used by cyclists for training for the Olympic Games.

If you’re looking for a way to support fitness lovers on their journey, such Bluetooth Low Energy devices is exactly what can help you

Such Bluetooth Low Energy devices can provide great support for those interested in sports (image by Dmitrii Kharchenko)

These glasses are BLE-based technology using Augment Reality features that are able to provide athletes with real-time data like speed, distance, cadence, calory count, heart rate, etc. Additionally, it can communicate with such popular cycling apps as Strava, MapMyRide, and TrainingPeaks.

Users can actually see the data in front of their eyes while wearing glasses, thanks to an intuitive interface. To see more visual content and videos on how the Solos are used, you can visit their Kickstarter page.

iBeacons & Bluetooth Devices for Gym Management Automation

BLE integration doesn’t necessarily have to be about providing fitness devices to your customers — it can also be used for management & marketing services. Namely, you can use Beacons for such purposes.

Beacons are Bluetooth Low Energy devices that constantly radiate radio waves that other BLE- or Bluetooth-enabled devices can see. Their main purpose is “taking over” the device they communicate with to perform specific actions — open a webpage, start an app, launch a marketing campaign, etc.

When researching the topic, you’ll definitely come across iBeacons. These are simply BLE-based beacons from Apple. There are some technical differences but those are irrelevant to us now.

Basically, when users’ devices get into a beacon’s range, they do what beacons ask them to, meaning you can easily use them for business purposes.

However, this functionality relies on location permission, which users may not always grant, limiting the effectiveness of beacon-based strategies. Obtaining the necessary location permission is crucial for ensuring seamless BLE integration and optimal performance of beacon technology within your business operations.

Bluetooth Low Energy can also offer businesses gym management support over an iOS or Android app, web application, etc.

An app for Bluetooth Low Energy device control can also function as a support for gym management (image by Estimote)

Let’s take a look at use cases:

Equipment Guidance

Whenever users approach a certain exercise machine, you can offer users watch a tutorial on how to use it or watch a guided workout.

After-Care

When users leave the gym, you can send them information on how to avoid muscle soreness and appropriately recover.

Social Media Marketing

You can send users reminders to share their feedback with you/on social media, and offer incentives for that (like discounts, merch, extra classes, etc.).

All of that can be done even if you don’t have an app. However, in case you do, you get access to much more detailed customer information. It allows you to personalize your campaigns better and generally adjust your approach to clients’ needs.

If you have questions on possible beacon use cases for your business, feel free to contact us — we’ll do our best to consult you!

📲 BLE Integration Process for Fitness Devices

In this section, we’ll talk about how you can enable communication between the fitness device and users' mobile devices. Your users are the ones who would perform the final connection by clicking the “Connect” button. What you have to do is take care of all the back- and front-end so users have a highly user-friendly solution.

Let’s first divide this section into 2 parts. In the first part, we’ll talk about integrating your application with BLE-based fitness hardware from third-party providers. In the second one, we’ll talk about connecting custom BLE devices with applications, which is a whole different process.

Let’s start with the first option.

Third-Party Fitness Devices

The hardware part isn’t something you should worry about at all in this case. If you partner with a third-party device provider, you’ll most likely have a ready-to-use BLE-based fitness solution. They’ll also provide you with an SDK and/or API for building an app and/or establishing communication channels.

SDKs and APIs are two of the most important concepts when working with third-party providers. They’re often used in a bundle but can surely exist without one another.

An API is an intermediary between the device and the user. So, in your case, you’ll be enabling users to control a fitness device using your application. An SDK is a broader concept that combines several development tools for building an application for certain hardware of API.

Often, an SDK includes API as part of the development package. An API, on the contrary, can’t contain SDKs. To better understand the difference between these 2 concepts, you can watch this explanatory video:

For fitness app developers involved in BLE development, the chances that their hardware provider won’t offer an SDK/API as part of the cooperation are minimal. In case that happens, they’ll most likely refer you to their partners who have solutions for their products specifically.

So, generally, the steps you should follow when opting for a partnership with a third-party fitness device provider are as follows:

  • Think about what device(s) you’re looking for and start exploring your provider options.
  • Find a hardware provider so as to offer users a full-on solution that’s ready for usage the moment they get it.
  • Check if the provider has an SDK/API. If yes, make sure they meet your business needs. For example, an API to establish the connection between a fitness band and an Android phone app is totally irrelevant to you if you’re building an iOS application. If they don’t, think about alternatives.
  • Find a Tech Partner or create an in-house development team to build an application with BLE API integration. This step doesn’t necessarily have to be done after the first 2. You can start the development journey with a Tech Partner by your side. Generally, the earlier you partner with decent iOS and/or Android developers, the better it is for your project.
  • Create an application and carry out the appropriate BLE integrations.

Now, let’s take a look at what options there are for you in case you have a custom firmware of BLE fitness device.

Integrating Custom BLE Fitness Devices

We can’t say that it’s much more complex because practically, it’s still working with code. It’s not like a person without coding knowledge would be able to use API to perform the integration. So, if you have enough coding expertise yourself, an in-house development team, or a trusted Tech Partner, it shouldn’t be a problem. Let’s briefly talk about what you need for that.

Your device needs a well-functioning BLE module

Bluetooth Low Energy integration process will differ depending on whether you have a custom device or use one from a third-party provider (image by Ofspace)

Of course, your device needs a well-functioning BLE module. If it works well, you need a library for BLE implementation for your specific framework. First, let’s cover what a library for a framework is.

Long story short, a library is a storage for prewritten code (files, functions, routines, etc.) that can be used for the development of applications and their integration with other applications, services, devices, etc.

So, a library for a framework implies the collection of code for this specific framework (React Native, Native Android, or any other one). In the following table, we’ve collected libraries for the most widespread programming languages:

Programming language

Library

Native iOS (Swift)

Native Android:

React Native:

react-native-ble-plx (combines RxBluetoothKit & RxAndroidBle). Our team works primarily with this library

Flutter:

Then, your development team performs the integration using the corresponding library and enables communication between the device and the app. That’s it, that’s how the whole magic happens.

If there isn’t one for your desired framework or need help with the development, feel free to contact us — we’ll provide you with the necessary information and help!

The way we described it now might create an impression that the job is in fact pretty easy but don’t get us wrong — for it to be “easy”, developers need to have a high level of expertise.

Configuring BLE Connections in React Native

If you're eager to gain hands-on experience with BLE integrations, this section is for you. Our developer, Andrian Yarotskyi, will show you a practical example of BLE connection integration using React Native and react-native-ble-plx.

Lets’ go! 🚀

  1. Import the required module.
  1. Initialize the BLE Manager. It’s important to do it only once per runtime, since the opposite action can lead to a memory leak.
  1. Scan for available BLE devices.

In this code snippet SERVICE_UUIDS is an array of UUID-like strings that refer to BLE services, defined in Bluetooth Core Specification. There are many conventional BLE services like Heart Rate Service, but if you’re implementing a custom protocol, then you’ll have to collaborate with the manufacturer to find out the required service and characteristics UUIDs (Universally Unique Identifier). SCAN_OPTIONS is an object that allows to implement a fine-grained scan, adjusting the scan behavior to the project requirements.

  1. Connect to a specific BLE device. The method returns a promise that will resolve if all conditions are met: the device is turned on, is in pairing mode and is in a physical layer, and otherwise will reject with an error.
  1. Discover services and characteristics of the connected device. It is a specific requirement of this library, since without this step you won’t be able to read or write to any characteristic.

Each service has at least one characteristic. Characteristics allow one or more of these actions or none of them: read, write and notify. To find out which characteristics you need to use for the communication with you device, you’ll need to contact the manufacturer or research the service documentation.

  1. Monitor particular characteristic(s) with allowed notifications to receive data updates from the device. BLE standards define two ways to transfer data from the server to the client: notification and indication. The main difference is that indications must be confirmed by the client by sending a message back to the server. The library automatically handles both cases for us, as stated in the docs.
  1. Write data to a characteristic of the connected device. The data argument is a base64-represented byte array. To transform a byte array to a base64 string and vice versa you can use btoa and atob methods. But since those methods are not available in React Native runtime out of the box, you’ll have to use an external library like base-64 or implement them yourself.

Overall, by following the steps outlined above, you can seamlessly extract data from and interact with BLE devices. However, being mindful of potential interference and security concerns inherent in such implementations is crucial. Ensuring your platform's security remains paramount, especially when dealing with sensitive data exchanges over Bluetooth connections.

How much does a fitness app cost with BLE integration? To get an accurate estimate, you should decide on the app’s key features and consult with experienced app developers who can provide a detailed breakdown of costs tailored to your project.

🚴 Our Expertise: SportPlus & Multiple BLE Devices Integration

Even though the general steps of enabling communication between BLE fitness devices and users is a common practice, developers need to have a high level of expertise to perform these steps time- and resource-efficient.

In this section, we’ll share our fitness app development company expertise in integrating BLE-based devices for the SportPlus app. The project is extremely useful to learn about as we’ll share how to approach the integration of several BLE fitness devices using one application.

Generally, SportPlus offers various exercise equipment and machines. The company asked us to build an app that would work with multiple fitness devices, meaning that we had to enable the communication for different BLE protocols.

You can build an Android and/or iOS application if that’s a one for mobile devices, otherwise, you can also build a web app

Make sure to think about the server where you’ll store data (shots from SportPlus)

But what is a protocol after all? Basically, you can think about it as a language that the device “speaks” and that has to be used for communication. The fact of devices being based on the same wireless network (in our case, BLE) doesn’t mean, however, that they’ll have the same protocols. In addition, each device on the network has a unique Media Access Control (MAC) address, serving as its distinct identifier within the network system.

So, the challenge comes when we have several BLE-based elliptical machines, for example, that all have different protocols for integration and communication. In other words, they all perceive commands and requests differently.

For example, one device doesn’t require anything for connection — you simply perform a BLE connection (enable the “Connect” button). Another protocol requires one line of code, and a third one might need 3 lines of code sent in a specific order with a predefined holdup.

The same thing works for communication itself. If we want to change the speed of some elliptical machines from different providers, the prompt for that can be different for all of them. Some might specifically require a line that starts with the “3, 2 …” number and ends with “20”. This is how the device will understand that it needs to do something with speed settings.

Following the general logic, all devices might have different line specifications for different commands. And every single detail from the order of numbers in the line to the line length is important — even the slightest deviation from the protocol will throw errors.

What’s even more exciting is that developers often don’t know what protocols they’re dealing with. Just like in real life: when you approach a person, you can’t be sure what language they speak so you start trying out every possibility.

In such cases, we try to communicate with the device using various numbers and command combinations to figure out what the device uses. Surely, there are some “unspoken” rules of how protocols are formed. It’s not like out of 1M fitness bands, each one of them has different protocols.

Once BLE device returns responses to developers in accordance with a certain protocol, they’re able to define its structure and easily communicate with the device. This allows them to create React Native fitness apps that facilitate seamless communication across various BLE devices.

BLE devices integration

Integrating several BLE devices with different protocols is pretty challenging yet simple with enough technical expertise (image by Kajetan Iżycki)

Here’s the summary of the steps you should take to integrate multiple BLE devices that have different protocols:

  • You partner with a fitness device provider and the protocol of the device can be whichever.
  • Your development team or Tech Partner tries to communicate with the device using different “languages”.
  • When they finally get an interpretable reply, they define the protocols’ structure.
  • Now, we’re able to connect and communicate with the device in a required “language”.

Learn how to develop a personal trainer app that meets all your needs by following our recommendations and professional advice.

💡 Takeaways

After reading this article, we hope you have a better understanding of how the whole integration process happens. With the right approach, integrating BLE fitness devices with your application can significantly improve the user experience your customers get.

Even though we’ve provided you with a general flow of how to approach the integration process, keep in mind that you’ll most likely need to adjust the process according to your business needs.

If you have any questions left or need help with integrating BLE appliances with your application, don’t hesitate and contact us. The Stormotion team is here for you! 🚀

Contact us

Questions you may have

Take a look at how we solve challenges to meet project requirements

What are the key challenges in BLE integration and how can I overcome them?

Key challenges in BLE integration include understanding various protocols, ensuring compatibility across devices, and optimizing power consumption. To overcome them, partner with experienced developers, thoroughly test compatibility with different devices, and implement power-saving strategies like minimizing active scanning.

Can you recommend any libraries or tools for developing BLE connections in mobile apps?

For developing BLE connections in mobile apps, popular libraries include RxBluetoothKit for native iOS, Android-BLE-Library or RxAndroidBle for native Android, and react-native-ble-plx for React Native. These libraries provide comprehensive tools for managing BLE communication efficiently.

How do I ensure my app remains compatible with a wide range of BLE fitness devices?

To ensure compatibility with a wide range of BLE fitness devices, it's crucial to follow standardized protocols and specifications such as GATT (Generic Attribute Profile) and UUIDs (Universally Unique Identifiers). Additionally, thorough testing with different devices during the development process can help identify and resolve compatibility issues early on.

What are the security considerations when connecting to BLE devices?

When connecting to BLE devices, security considerations include encryption of data transmissions, authentication mechanisms to verify device identities, and implementing secure pairing procedures. It's also important to regularly update firmware and software to address potential security vulnerabilities and protect user data from unauthorized access.

How can I manage multiple BLE connections simultaneously in my app?

Managing multiple BLE connections simultaneously in an app involves careful resource management and prioritization of connections based on user interactions. Implementing efficient connection handling mechanisms, such as connection pooling and background scanning, can help optimize resource usage and ensure the smooth operation of the app with multiple connected devices.

What's the impact of BLE on the app's battery life, and how can it be optimized?

BLE can have a significant impact on the app's battery life due to continuous scanning and data transmission. To optimize battery usage, you can minimize the frequency and duration of BLE operations, use low-power modes whenever possible, and implement efficient data synchronization strategies. Optimizing app background activity and minimizing unnecessary BLE scanning can also further reduce battery consumption.

How do I troubleshoot common BLE connectivity issues in fitness apps?

Common BLE connectivity issues in fitness apps may include device pairing failures, intermittent disconnections, and data synchronization errors. Debugging tools provided by BLE libraries can help diagnose communication errors, while thorough testing across different environments can identify potential connectivity issues early in development.

Read also

How can we help you?

Our clients say

Stormotion client Max Scheidlock, Product Manager from [object Object]

They understand what it takes to be a great service provider, prioritizing our success over money. I think their approach to addressing ambiguity is their biggest strength. It definitely sets them apart from other remote developers.

Max Scheidlock, Product Manager

HUMANOO