HealthKit ↔ Health Connect type reference
aifitnessapi.com| Metric | Apple HealthKit (iOS) | Health Connect (Android) |
|---|---|---|
| Heart rate | HKQuantityTypeIdentifier.heartRate, .restingHeartRate | HeartRateRecord, RestingHeartRateRecordWatch out: Both expose samples plus a separate resting value — don't derive resting yourself. |
| HRV | HKQuantityTypeIdentifier.heartRateVariabilitySDNN | HeartRateVariabilityRmssdRecordWatch out: The big one: Apple stores SDNN, Health Connect stores RMSSD. They are different measures and are not interconvertible — do not normalize one into the other. |
| VO2 max | HKQuantityTypeIdentifier.vo2Max | Vo2MaxRecordWatch out: An estimate on both platforms, not a lab measurement. Health Connect tags a measurement method. |
| Blood oxygen | HKQuantityTypeIdentifier.oxygenSaturation | OxygenSaturationRecordWatch out: The type existing doesn't mean data exists — SpO2 is device-gated, and Apple Watch availability in the US has been subject to litigation. Verify current status. |
| Sleep | HKCategoryTypeIdentifier.sleepAnalysis (values: inBed, awake, asleepCore, asleepDeep, asleepREM, asleepUnspecified) | SleepSessionRecord (carries stages)Watch out: Stage vocabularies differ and stages are estimated, not measured. Apple's .asleep is deprecated in favour of the specific stages. |
| Steps | HKQuantityTypeIdentifier.stepCount (CMPedometer for live counts) | StepsRecord, StepsCadenceRecordWatch out: De-duplicate: phone and watch both write steps. On Android, from the June 2026 update on-device steps are attributed to a per-device Synthetic Package Name — read it via getCurrentDeviceDataSource(), never hardcode it. |
| Workouts | HKWorkout (HKWorkoutBuilder) | ExerciseSessionRecord, PlannedExerciseSessionRecordWatch out: Activity-type taxonomies differ between platforms — map them explicitly rather than by name. |
| GPS route | HKWorkoutRoute (array of CLLocation), HKWorkoutRouteQuery | ExerciseRoute with ExerciseRoute.LocationWatch out: Health Connect gates routes behind their own permission (READ_EXERCISE_ROUTES) and restricts background reads of other apps' routes. |
| Calories | HKQuantityTypeIdentifier.activeEnergyBurned, .basalEnergyBurned | ActiveCaloriesBurnedRecord, TotalCaloriesBurnedRecordWatch out: Modelled estimates, not measurements. Note the asymmetry: Apple splits active/basal, Android offers active and total — don't add active to total. |
| Body composition | HKQuantityTypeIdentifier.bodyMass, .bodyFatPercentage, .leanBodyMass, .bodyMassIndex | WeightRecord, BodyFatRecord, LeanBodyMassRecord, BoneMassRecord, BodyWaterMassRecord, BasalMetabolicRateRecordWatch out: The store holds it, but something has to write it — usually a smart scale or manual entry. Body fat is a bioimpedance estimate. |
Both stores are on-device — there is no server endpoint to call. Type identifiers change: confirm against Apple’s and Google’s live docs before you build.
Full reference, notes and sources on aifitnessapi.com/matrix↗ — a free reference from AIFitnessAPI. This widget shows whatever the source page says today, so it changes when we update it.