HealthKit Integration

Complete technical reference for Cardio Analytics HealthKit data types and sync patterns

HealthKit Data Types Used

Cardio Analytics reads 11 cardiovascular and mobility metrics from Apple HealthKit using first-party identifiers:

Heart Rate Metrics

  • HKQuantityTypeIdentifier.heartRate - Current heart rate (counts/min) (Apple Docs)
  • restingHeartRate - Resting heart rate baseline (Apple Docs)
  • walkingHeartRateAverage - Average HR during walking

Cardiovascular Metrics

  • bloodPressureSystolic + bloodPressureDiastolic - Paired BP readings with correlation (Apple Docs)
  • heartRateVariabilitySDNN - Overall HRV variability (SDNN in milliseconds)
  • heartRateVariabilityRMSSD - Short-term vagal tone (RMSSD in ms, where available)
  • oxygenSaturation - SpO₂ as fraction (0.0-1.0, display as %) (Apple Docs)

Body Composition

  • bodyMass - Weight in kg
  • height - Height in meters (used to calculate BMI)

ECG & Atrial Fibrillation

  • electrocardiogramType - ECG recordings with HKElectrocardiogram.Classification including .atrialFibrillation (Apple Docs)
  • atrialFibrillationBurden - AF burden percentage (where available, watchOS 9+) (Apple Docs)

Fitness & Mobility Metrics

  • vo2Max - Maximal oxygen uptake (mL/kg/min) (Apple Docs)
  • walkingSpeed - Average steady walking speed (m/s) (Apple Docs)
  • walkingAsymmetryPercentage - Gait imbalance percentage (Apple Docs)
  • stairAscentSpeed - Stair climbing speed (m/s) (Apple Docs)

Background Sync Patterns

Anchored Object Queries

HKAnchoredObjectQuery enables delta synchronization, fetching only new or modified data since the last sync (Apple Docs).

  • Efficient battery usage - Only fetches changed data, not entire datasets
  • Persistent anchor - Stores last sync point to resume after app restart
  • Handles deletions - Receives deleted samples for accurate sync

Background Delivery

HKHealthStore.enableBackgroundDelivery allows HealthKit to automatically wake the app when new data becomes available (Apple Docs).

  • Immediate updates - Fresh cardiovascular data without manual refresh
  • Battery efficient - System-managed wake-ups minimize power consumption
  • Reliable delivery - Works even when app is closed

📱 Required entitlement: com.apple.developer.healthkit.background-delivery (Docs)

Write-Back Capabilities

User-entered data (weight, blood pressure) can be written back to HealthKit for consistency across all health apps and devices.

  • Unified health record - Data entered in Cardio Analytics appears in Apple Health
  • Clinician visibility - Doctors using HealthKit-connected systems see consistent records
  • Cross-app compatibility - Other health apps can access your Cardio Analytics entries
  • Device attribution - HealthKit tracks which app/device recorded each sample

Privacy & Granular Permissions

HealthKit authorization is granular - users approve or deny each data type individually. Cardio Analytics respects all permission decisions:

  • Granular read/write permissions - User chooses which metrics to share
  • No access to unauthorized types - HealthKit enforces permission boundaries
  • Revocable anytime - Users can change permissions in iOS Settings → Privacy → Health
  • No server transmission - All data stays on-device; HealthKit authorization doesn't grant server access

Read Full Privacy Policy

Experience Seamless HealthKit Integration

Download Cardio Analytics and connect with Apple HealthKit for automatic cardiovascular monitoring.

Download on App Store