가이드
Apple HealthKit 및 Health Connect와 관련된 건강 정보에 대한 튜토리얼
Using @capgo/capacitor-health
Capacitor 플러그인을 사용하여 Apple HealthKit 및 Health Connect에서 데이터와 상호 작용하는 방법
설치
bun add @capgo/capacitor-health
bunx cap sync
이 플러그인이 제공하는 것
isAvailable- 현재 플랫폼이 네이티브 건강 SDK를 지원하는지 여부를 반환합니다.requestAuthorization- 제공된 데이터 유형에 대한 읽기/쓰기 접근을 요청합니다.checkAuthorization- 사용자에게 프롬프트하지 않고 제공된 데이터 유형에 대한 인증 상태를 확인합니다.readSamples- __CAPGO_KEEP_0__ 샘플을 지정된 시간 범위 내에서 주어진 데이터 유형을 읽습니다.
예시 사용
isAvailable
현재 플랫폼이 SDK를 지원하는지 여부를 반환합니다.
import { Health } from '@capgo/capacitor-health';
await Health.isAvailable();
requestAuthorization
제공된 데이터 유형에 대해 읽기/쓰기 접근 권한을 요청합니다.
import { Health } from '@capgo/capacitor-health';
await Health.requestAuthorization({} as AuthorizationOptions);
checkAuthorization
사용자에게提示하지 않고 제공된 데이터 유형에 대한 인증 상태를 확인합니다.
import { Health } from '@capgo/capacitor-health';
await Health.checkAuthorization({} as AuthorizationOptions);
readSamples
주어진 데이터 유형을 지정된 시간 범위 내에서 샘플을 읽습니다.
import { Health } from '@capgo/capacitor-health';
await Health.readSamples({} as QueryOptions);
전체 참조
- GitHub: https://github.com/Cap-go/capacitor-health/
- 문서: /docs/plugins/health/