For the complete documentation index, see llms.txt. This page is also available as Markdown.

Direct bluetooth device connection

Starting with version 5.3.0, the Thryve SDK supports Garmin Companion

With Thryve, you can connect Garmin Companion devices, blood glucose monitors and heart rate monitors directly via Bluetooth Low Energy (BLE). The Thryve Device module abstracts the complexity of Bluetooth integration by providing:

  • Effortless connectivity: Automatically handles permissions, device discovery, connections, and communication.

  • Automated data access: Retrieves health data from connected devices and uploads it to the Thryve data warehouse, ensuring your application always has up-to-date metrics.

  • Comprehensive device handling: Manages device interactions end-to-end, from connection stability to reliable data acquisition.

This guide explains how to let users connect and disconnect devices and includes UI integration examples. For a best-practice implementation, refer to the Thryve Sample App.

The module is compatible with Blood Glucose Monitors and Heart Rate Monitors that adhere to open Bluetooth device profiles. Devices from manufacturers that do not follow Bluetooth standards may not function properly.

Verified Blood Glucose Monitors

Correct functionality has been verified for the following devices:

  • Roche ACCU-CHEK Instant

  • Roche ACCU-CHEK Guide

  • FORA 6 Connect

  • Contour Care

Verified Devices with real-time BLE broadcasting capabilities

Correct functionality has been verified for the following devices:

Integrate Thryve BLE with your application

To be able to integrate ThryveBLE module you need to:

  1. Integrate the ThryveBLE module for Blood Glucose Monitors and Heart Rate Monitors and/or Integrate the ThryveGarminCompanion modules for Garmin Companion devices Make sure to also add ThryveCore and ThryveCommons modules. Follow either the cocoapods or framework files instructions in the iOS section.

  2. Add Bluetooth Capability In Xcode: Navigate to Target → Signing & Capabilities → add (+) → Bluetooth.

  3. Add Bluetooth Background Mode In Xcode: Navigate to Target → Signing & Capabilities → add (+) Background Modes → "Uses Bluetooth LE accessories" - it is needed if you want streaming to continue in the background.

  4. Add Privacy - Bluetooth Always Usage Description to Info.plist <key>NSBluetoothAlwaysUsageDescription</key>

    <string>Bluetooth permission for Thryve</string>

  1. Integrate the thryve_module_ble module for Blood Glucose Monitors and Heart Rate Monitors and/or Integrate the thryve_module_garmin_companion module for Garmin Companion devices. Make sure to also add thryve_core_sdk and thryve_module_commons modules. Follow the instructions in either the Thryve Repository Dependencies or Thryve .aar Libraries in the Android section

  2. Add the following BLUETOOTH permissions to the AndroidManifest.xml

  3. Add the ACCESS_FINE_LOCATION permission to AndroidManifest.xml This is required for all applications targeting Android devices running below Android 12

Configure the ThryveBLE and ThryveGarminCompanion modules

When initializing Thryve SDK make sure to define the deviceTypes and an optional ThryveDeviceEventListener in the ThryveDeviceConfig .

Parameter
Description
Mandatory

deviceTypes

Limits the BLE device types the host application supports (e.g. garminCompanion or heartRateMonitor). Only devices matching the ThryveDeviceType will appear in discovery.

no

garminCompanionConfig

Configuration for ThryveGarminCompanion module

license Garmin Companion specific license issued by Garmin.

dataTypes ThryveGarminCompanionDataType supported by your app.

modes ThryveGarminCompanionMode supported by your app. Only realTime mode is currently supported

no

eventListener

An object of ThryveDeviceEventListener that will have to implement the following functions to receive events from the Thryve BLE modules.

no

Allow users to connect to devices

To enable Bluetooth connectivity for users, implement the following features:

  • Display a list of nearby devices available for connection.

  • Allow users to connect to and disconnect from devices.

  • Provide connection status and troubleshooting information.

Using ThryveBLE, these functionalities can be achieved quickly with just a few functions to expedite your initial integration.

Start device discovery

To discover nearby BLE devices, initiate startDeviceDiscovery. Handle any found devices using onDeviceFound in the ThryveDeviceEventListener. The discovery will end when stopDeviceDiscovery is called or the discovery process timed out as per configuration.

The Thryve SDK only returns Bluetooth devices that match the configured Bluetooth Device Profiles, automatically filtering out unsupported devices.

Be aware that devices may appear compatible if manufacturers advertise open Bluetooth Device Profiles in device discovery, yet choose proprietary integration methods for connection and data access.

Recommendation:

Manage the scanning process carefully. Avoid continuous scanning or high scanning timeouts when no devices are available, or users opt not to connect a device. Continuous scanning can significantly drain the smartphone's battery, leading to user frustration and potential app uninstallation.

Connect to BLE device

To enable users to connect to a BLE device upon a button click, utilize the connectDevice method from the ThryveBLE. Handle the connection status through the ThryveDeviceEventListener interface, using the onDeviceConnecting and onDeviceConnected callback methods for processing connection events effectively.

Showing Bluetooth Device Pairing Process
Pairing process with Roche ACCU-CHEK Guide

Once connected, all available data is automatically retrieved and uploaded to the Thryve backend. For broadcasting devices like heart rate monitors, heart rate data is accessible locally in real-time and is automatically uploaded every 300 readings or every 5 minutes, or on stop/disconnect.

Disconnect BLE device

To enable users to manually disconnect their BLE device, use disconnectDevice. Handle the disconnection status with the ThryveDeviceEventListener's onDeviceDisconnected callback.

Show device connection status

We recommend to transparently display users actively connected devices as well as known, previously connected devices and allow them to re-connect those.

Get active devices

Get previous devices

Last updated