Terra

Integration

API
Unified API
SDK
SDK
Authentication
Authentication
Streaming
Streaming
Blood
Blood Report API
Planned Workout
Planned Workout
AI Interface
AI Interface

User engagement

Graph API
Graph API
Scores
Health Scores
Rewards
Health Rewards

Use cases

Enterprise
Enterprise
Insurance
Insurance

Developers

Wearable Data
Wearable Data
Community
Community
Documentation
Documentation

Learn

Blog
Blog
Podcast
Podcast
Events
Events
Reports
Reports

Company

Customers
Customers
Careers
Careers
Partners
Partners
Support
Support
Become an integration
Become an integration
next ventures
pioneer fund
samsung next
y combinator
general catalyst

The world's best health apps run on Terra data

ProductsIntegrations Authentication Mobile Development Documentation GraphAPI
DocumentationAPI SDK Quickstart
CommunityBlog Research Community Podcast Github
CompanyAboutCareersCustomersBecome an IntegrationCookies PolicyGDPRPrivacy PolicyTerms of Purchase
© Terra API. 2025 — All rights reserved.

Cookie Preferences

Essential CookiesAlways On
Advertisement Cookies
Analytics Cookies

Crunch Time: Embrace the Cookie Monster Within!

We use cookies to enhance your browsing experience and analyse our traffic. By clicking “Accept All”, you consent to our use of cookies according to our Cookie Policy. You can change your mind any time by visiting out cookie policy.

< Blogs
Elliott Yu
Elliott Yu

July 28, 2022

How-tos: ANT+ Devices

When people think about connections between "activity trackers", or wearables and devices, they usually think about Bluetooth or Bluetooth Low Energy. However, there exists another communication protocol that is actually very commonly used in the fitness world. This is the ANT protocol.

What is it

In its essence, ANT is just a communication method between two devices similar to Bluetooth Low Energy (BLE), except that ANT typically does one-way communication whereas BLE does two-way connections. In addition to this, ANT uses way less energy and can connect many devices at once whereas BLE is usually limited to only a couple of devices.

ANT+ on the other hand are device profiles that follow the ANT protocol and defines the type of information transferred by that profile. For example, there is a device profile for Heart Rate monitors which is specified to only broadcast Heart Rate data. There are also ones for bike speed sensors, bike cadence sensors, and more.

ANT+ Connections Basics

ANT+ device connections can be done if you follow the ANT protocol as shown by ANT's official page. Luckily, we can take this to a higher level and avoid transmitting and receiving bits by using the already given ANT+ SDK on Android (N.B this SDK would require you to install two additional plugins on your device). Trust me if you are not a big fan of hardware specifics, you might want to just download the SDK.

Once the SDK is installed, you can start searching and connecting to devices. We can use the following steps as a guide to how we can do this:

  • Search for device
  • Connect to the device and request permissions from the device
  • Subscribe to the data you want

Searching

Let us start with searching for a device. This can be done using MultiDeviceSearch class from the SDK

Assume we are only going to search for HEARTRATE supported devices here. We will then also need to implement a searchCallback and rssiCallback. These serve as callback methods for different events, such as when a device has been found, or when the search has started and stopped.

Perfect! We now can scan for any devices that support HEARTRATE updates. From here, we can directly try to connect to the device from onDeviceFound and try to read the device's heart rate values.

Connecting

Let us edit the onDeviceFound callback to try connect to the first device found (for convenience of course. In reality this should be handled differently, perhaps a ListAdapter showing all the new found devices and having a frontend to select which device to connect to)

The connection is done by the requestAccess function here. This function requires you to implement two other callbacks: pluginAccessResultReceiver and deviceStateChangeReceiver :

Thats it! You should now be connected (at least given that the pluginAccessResultReceiver receives a SUCCESS in the callback).

Subscribing

Now that we have connected, the last thing we need is to subscribe to the device's updates.

Let's try to subscribe to the HEARTRATE events from the device. From the onResultReceived callback function, we have a Plugin Communicator Class (PCC) object that is connected to the device. We can subscribe to the events from this class:

Thats it! You can now take the value from the onNewHeartRateData and display it or stream it to your backend for further processing.

Quick-Go

Terra has abstracted ALL of this implementation into a single SDK: TerraRTAndroid. The SDK not only subscribes to Heart Rate event devices as shown in this example, but it also provides:

  • Connecting to ANY ANT+ device imaginable
  • A frontend widget to select which device to connect to
  • A comprehensive selection of datatypes to subscribe to
  • The data is streamed straight to your backend through our WebSocket API
  • Seamlessly disconnect and unsubscribe from the devices and datatypes.

If you really aren't in the mood to implement all the steps highlighted in this blog, check out our SDK (installed in one line and only requires you to run two functions to start receiving data: startAntPlusScan and startRealtime.)

Related Articles

5 Lessons for Standing Out at HLTH

December 5, 2024

5 Lessons for Standing Out at HLTH

5 lessons from team Terra API for making a lasting impact at HLTH: from engaging senses to building real touch points, here’s what we learned from the HLTH event.

Vanessa Neeff
Strava Pulls the Plug on their API: What This Means for Developers

November 21, 2024

Strava Pulls the Plug on their API: What This Means for Developers

Strava discontinued their API service, changing the ecosystem of third-party apps that have relied on their platform. How can developers react to this?

Terra APITerra API
Alternatives to the latest changes in the Strava API

November 19, 2024

Alternatives to the latest changes in the Strava API

Strava just introduced big changes to their API program. These changes will basically kill off a lot of apps. Use Terra API instead to avoid this

Kyriakos EleftheriouKyriakos Eleftheriou

More Topics

All Blogs
Team Spotlight
Startup Spotlight
How To
Blog
Podcast
Product Updates
Wearables
See All >
Head of Samsung Next: David Lee

Head of Samsung Next: David Lee

David Lee shares insights from his 30-year journey in healthcare and tech, revealing how his battle with stage four lymphoma shaped his career.

Kyriakos EleftheriouKyriakos Eleftheriou
May 1, 2026
HYROX CGO: Douglas Gremmen

HYROX CGO: Douglas Gremmen

Douglas Gremmen shares how HYROX sold 42,000 tickets in a day and expanded to 15,000 gyms worldwide.

Kyriakos EleftheriouKyriakos Eleftheriou
April 8, 2026
CTO + Director of AI at Flo Health: Roman Bugaev + Vladislav Nedosekin

CTO + Director of AI at Flo Health: Roman Bugaev + Vladislav Nedosekin

Roman Bugaev and Vladislav Nedosekin discuss scaling Flo Health to 80 million users and the AI innovations driving their growth.

Kyriakos EleftheriouKyriakos Eleftheriou
March 2, 2026
Glovo and Yellow.vc Co-Founder: Sacha Michaud

Glovo and Yellow.vc Co-Founder: Sacha Michaud

Sacha Michaud shares how Glovo scaled to 25+ countries and a $2.3 billion acquisition, starting with a simple text button app.

Kyriakos EleftheriouKyriakos Eleftheriou
January 18, 2026
Thriva CTO: Tom Livesey

Thriva CTO: Tom Livesey

Tom Livesey, CTO of Thriva, discusses how the company scaled to deliver over 4 million tests and raised $11 million.

Kyriakos EleftheriouKyriakos Eleftheriou
October 21, 2025