Skip to content

@capgo/capacitor-health

Capacitor plugin to interact with data from Apple HealthKit and Health Connect.

@capgo/capacitor-health reads and writes user health data through Apple HealthKit on iOS and Health Connect on Android. Use it for step counts, workouts, sleep stages, vitals, and nutrition style samples without maintaining two separate native SDK integrations in your app layer.

Fitness dashboards, habit apps, clinical adjacent wellness products, and corporate wellness programs commonly start with requestAuthorization, then readSamples or saveSample for the metrics they care about.

PlatformSupportNotes
iOSYesHealthKit authorization and samples
AndroidYesHealth Connect, optional history permission for reads beyond about 30 days
WebLimitedisAvailable reports unsupported native SDKs

Android only helpers: openHealthConnectSettings, showPrivacyPolicy.

  • isAvailable - Returns whether the current platform supports the native health SDK.
  • requestAuthorization - Requests read/write access to the provided data types.
  • checkAuthorization - Checks authorization status for the provided data types without prompting the user.
  • readSamples - Reads samples for the given data type within the specified time frame.
MethodDescription
isAvailableReturns whether the current platform supports the native health SDK.
requestAuthorizationRequests read/write access to the provided data types.
checkAuthorizationChecks authorization status for the provided data types without prompting the user.
readSamplesReads samples for the given data type within the specified time frame.
saveSampleWrites a single sample to the native health store.
getPluginVersionGet the native Capacitor plugin version.
openHealthConnectSettingsOpens the Health Connect settings screen (Android only). On iOS, this method does nothing.
showPrivacyPolicyShows the app’s privacy policy for Health Connect (Android only). On iOS, this method does nothing.
queryWorkoutsQueries workout sessions from the native health store. Supported on iOS (HealthKit) and Android (Health Connect).
queryAggregatedQueries aggregated health data from the native health store. Aggregates data into time buckets (hour, day, week, month) with operations like sum, average, min, or max. This is more efficient than fetching individual samples for large date ranges.

This reference is synced from src/definitions.ts in capacitor-health.

If you are using @capgo/capacitor-health to plan native plugin work, connect it with Using @capgo/capacitor-health for the native capability in Using @capgo/capacitor-health, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins, and Ionic Enterprise Plugin Alternatives for the product workflow in Ionic Enterprise Plugin Alternatives.