@capgo/capacitor-health
Capacitor plugin to interact with data from Apple HealthKit and Health Connect.
Overview
Section titled “Overview”Capacitor plugin to interact with data from Apple HealthKit and Health Connect.
Core Capabilities
Section titled “Core Capabilities”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.
Public API
Section titled “Public API”| Method | Description |
|---|---|
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. |
saveSample | Writes a single sample to the native health store. |
getPluginVersion | Get the native Capacitor plugin version. |
openHealthConnectSettings | Opens the Health Connect settings screen (Android only). On iOS, this method does nothing. |
showPrivacyPolicy | Shows the app’s privacy policy for Health Connect (Android only). On iOS, this method does nothing. |
queryWorkouts | Queries workout sessions from the native health store. Supported on iOS (HealthKit) and Android (Health Connect). |
queryAggregated | Queries 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. |
Source Of Truth
Section titled “Source Of Truth”This reference is synced from src/definitions.ts in capacitor-health.