Direct bluetooth device connection
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.
Integrate Thryve BLE with your application
To be able to integrate ThryveBLE module you need to:
Integrate the
ThryveBLEmodule for Blood Glucose Monitors and Heart Rate Monitors and/or Integrate theThryveGarminCompanionmodules for Garmin Companion devices Make sure to also addThryveCoreandThryveCommonsmodules. Follow either the cocoapods or framework files instructions in the iOS section.Add Bluetooth Capability In Xcode: Navigate to Target → Signing & Capabilities → add (+) → Bluetooth.

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.

Add
Privacy - Bluetooth Always Usage Descriptionto Info.plist<key>NSBluetoothAlwaysUsageDescription</key><string>Bluetooth permission for Thryve</string>
Integrate the
thryve_module_blemodule for Blood Glucose Monitors and Heart Rate Monitors and/or Integrate thethryve_module_garmin_companionmodule for Garmin Companion devices. Make sure to also addthryve_core_sdkandthryve_module_commonsmodules. Follow the instructions in either the Thryve Repository Dependencies or Thryve .aar Libraries in the Android sectionAdd the following
BLUETOOTHpermissions to theAndroidManifest.xmlAdd the
ACCESS_FINE_LOCATIONpermission toAndroidManifest.xmlThis 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 .
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.
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.

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

