How to Integrate BLE-Based Fitness Devices into your App

Published: June 3, 2022

15 min read

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.

Companies, on the other hand, 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 do you integrate those BLE devices into your app? Surely, the technical side isn’t something you have to perfectly understand as the provider unless you are the person who actually performs the integration.

Yet, our goal is to give you just about enough knowledge for you 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 Device: Tech Stack Basics Relevant for Integration

At its core, Bluetooth Low Energy is a wireless network that’s used for connecting two or more devices with each other so they can communicate (exchange data, for the most part). The two keywords that describe BLE are low power consumption, high battery longevity, and rapid connection.

Good to know but not a must: Bluetooth Low Energy (BLE, Bluetooth Smart) 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 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 basically generally 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_ contains 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 requests. 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 mobile 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. Clients are devices accessing the data, Servers are the ones responsible for storing and providing access.

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

Read also:

Bluetooth Low Energy FAQ: The Ultimate Guide on BLE Devices & iBeacons

💼 Bluetooth, BLE & Fitness Industry Use Cases

Most likely, if you’ve come here with the request to learn about BLE-based fitness device integration, you already know why Bluetooth Low Energy is something you chose out of all the 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-enabled 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 difference between BLE and Bluetooth is that BLE is designed for smaller amounts of data transfers with lower battery consumption. The battery 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 power.

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.

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 lower energy consumption. Now, let’s take a look at how BLE devices 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 use cases. However, the industry, including when you develop a mental health app, goes far beyond that and embraces a lot of fascinating technology.

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 Arman Rokni)

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:

Read also:

How to Make an Own Yoga app like Asana Rebel?

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. 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 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.

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 Fitness Integration Process

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, 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 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 a decent developer, the better it is for your project.
  • Create an application and carry out the appropriate integration.

Now, let’s take a look at what options there are for you in case you have a custom-built 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 LLC)

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 the 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.

🚴 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.

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 command 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 developers get a response in accordance with a certain protocol, they’re able to define its structure and easily communicate with the device.

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”.

💡 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

Read also

How can we help you?

Our clients say

Stormotion client Pietro Saccomani, Founder from [object Object]

They make the whole business work for us, and their improvements are fundamental to our operations. They’re reliable, honest, and willing to try new things that will help us. We appreciate how flexible and easygoing they are.

Pietro Saccomani, Founder

MobiLoud