# Real-time heart rate data

Access real-time heart rate data on your device using Thryve SDK. Users simply connect their heart rate monitor with Bluetooth broadcasting capabilities. Once connected, the data flows instantly to your mobile application, provided the connection is active.&#x20;

Enhance your health or fitness application with easy access to real-time heart rate data using the Thryve SDK. Users can effortlessly connect their heart rate monitors that support Bluetooth broadcasting and your application will have real-time data available, provided the connection is active.&#x20;

Use the real-time heart rate data availability via Thryve to build experiences for fitness enthusiasts to optimize their workouts using instantaneous heart rate feedback or allow for real-time heart rate monitoring in medical use-cases for improved care journeys.&#x20;

<details>

<summary>Verified Heart Rate Monitors</summary>

Correct functionality has been verified for the following devices:

* Coros Heart Rate Monitor
* Garmin HRM-Dual
* Polar H7 Heart Rate Sensor
* Polar H9 Heart Rate Sensor
* Polar H10 Heart Rate Sensor
* Suunto Smart Heart Rate Belt
* Whoop 4.0 (requires [enabled Heart Rate Broadcast](https://support.whoop.com/s/article/Heart-Rate-Broadcast?language=en_US))
* Whoop 5.0 (requires [enabled Heart Rate Broadcast](https://support.whoop.com/s/article/Heart-Rate-Broadcast?language=en_US))

</details>

## Connect heart rate monitor

Please refer to the [direct bluetooth device connection](/integrate-your-mobile-app/direct-bluetooth-device-connection.md) documentation for information on how to connect a heart rate monitor.

## Access real-time data

Capture live heart rate data via the `onHeartRateDataReceived` event in `ThryveBLEEventListener`. This event provides immediate access to data from connected heart rate monitors.

{% tabs %}
{% tab title="iOS" %}

<pre class="language-swift"><code class="lang-swift"><strong>import ThryveCore
</strong>import ThryveCommons
import ThryveBLE

class BLEViewModel: ObservableObject, ThryveBLEEventListener {
---    
    //onHeartRateDataReceived method is a ThryveBLEEventListener event listener callback.
    //It is automatically triggered by ThryveSDK each time a Heart Rate ThryveBLEDevice is connected 
    //The data recorded by Heart Rate monitors is shared with the host application 
    func onHeartRateDataReceived(device: ThryveBLEDevice, response: ThryveResponse&#x3C;ThryveBLEHeartRateMeasurement>) {
            guard response.successful else {
                  // Process all [ThryveErrors] in response.errors
                  return 
                }
               let heartRate = response.data 
               //process heartRate. example update UI
               //process the heart rate value with heartRate.heartRateValue.
               //process the sensor contact value with heartRate.sensorContactDetected
    }
---
}
</code></pre>

{% endtab %}

{% tab title="Android" %}

<pre class="language-kotlin"><code class="lang-kotlin">import com.thryve.sdk.ThryveSDK
import com.thryve.sdk.ble
...
<strong>override fun onHeartRateDataReceived(response: ThryveResponse&#x3C;ThryveBLEGattData.Measurement>) {
</strong>    if (!response.successful) {
       // Process all [ThryveError] in response.errors
       return
    } 
    //process measurement reading in response.data
 }
...
</code></pre>

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Data of connected devices is periodically uploaded to the Thryve backend in batches, rather than in real-time. This approach ensures persistent data storage while minimizing network and battery usage on devices.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thryve.health/integrate-your-mobile-app/real-time-heart-rate-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
