Search code examples
iosswifthealthkithkhealthstoreheartrate

Querying for heartRateVariabilitySDNN in HealthKit?


I notice in the Health App I receive a daily value for Heart Rate Variability. Per the HealthKit docs this is a sample that measures the standard deviation of heartbeat intervals. Yet when I query for HRV in my workout app during a workout I am not getting any samples returned. Is there a particular circumstance that must be present to return a value or is Apple just not sharing this with 3rd party developers yet (like vo2Max?).


Solution

  • Both HRV and VO2 Max samples are available to developers using HealthKit (you should be able to verify this by querying for them on an iPhone without a predicate). However, they are not calculated continuously by watchOS so you cannot depend on having a recently computed value of either type at any given time. The circumstances under which new HRV samples are computed is not documented, but you should be able to trigger the measurement of HRV by using the Breathe app.