Skip to main content
Back to plugins
@capgo/capacitor-health
Tutorial
by github.com/Cap-go

Health

Access health and fitness data from native health platforms

Guide

Tutorial on Health

Using @capgo/capacitor-health

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

Install

bun add @capgo/capacitor-health
bunx cap sync

What This Plugin Exposes

  • 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.

Example Usage

isAvailable

Returns whether the current platform supports the native health SDK.

import { Health } from '@capgo/capacitor-health';

await Health.isAvailable();

requestAuthorization

Requests read/write access to the provided data types.

import { Health } from '@capgo/capacitor-health';

await Health.requestAuthorization({} as AuthorizationOptions);

checkAuthorization

Checks authorization status for the provided data types without prompting the user.

import { Health } from '@capgo/capacitor-health';

await Health.checkAuthorization({} as AuthorizationOptions);

readSamples

Reads samples for the given data type within the specified time frame.

import { Health } from '@capgo/capacitor-health';

await Health.readSamples({} as QueryOptions);

Full Reference