Skip to content

ubie-oss/capacitor-health-connect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

capacitor-health-connect

Android Health Connect integration for Capacitor

Install

npm install capacitor-health-connect
npx cap sync android

Usage

import { HealthConnect } from 'capacitor-health-connect';

const healthConnectAvailability = await HealthConnect.checkAvailability();

API

checkAvailability()

checkAvailability() => any

Returns: any


insertRecords(...)

insertRecords(options: { records: Record[]; }) => any
Param Type
options { records: {}; }

Returns: any


readRecord(...)

readRecord(options: { type: RecordType; recordId: string; }) => any
Param Type
options { type: RecordType; recordId: string; }

Returns: any


readRecords(...)

readRecords(options: { type: RecordType; timeRangeFilter: TimeRangeFilter; dataOriginFilter?: string[]; ascendingOrder?: boolean; pageSize?: number; pageToken?: string; }) => any
Param Type
options { type: RecordType; timeRangeFilter: TimeRangeFilter; dataOriginFilter?: {}; ascendingOrder?: boolean; pageSize?: number; pageToken?: string; }

Returns: any


getChangesToken(...)

getChangesToken(options: { types: RecordType[]; }) => any
Param Type
options { types: {}; }

Returns: any


getChanges(...)

getChanges(options: { token: string; }) => any
Param Type
options { token: string; }

Returns: any


requestHealthPermissions(...)

requestHealthPermissions(options: { read: RecordType[]; write: RecordType[]; }) => any
Param Type
options { read: {}; write: {}; }

Returns: any


checkHealthPermissions(...)

checkHealthPermissions(options: { read: RecordType[]; write: RecordType[]; }) => any
Param Type
options { read: {}; write: {}; }

Returns: any


revokeHealthPermissions()

revokeHealthPermissions() => any

Returns: any


openHealthConnectSetting()

openHealthConnectSetting() => any

Returns: any


Type Aliases

HealthConnectAvailability

'Available' | 'NotInstalled' | 'NotSupported'

Record

{ type: 'ActiveCaloriesBurned'; startTime: Date; startZoneOffset?: string; endTime: Date; endZoneOffset?: string; energy: Energy; } | { type: 'BasalBodyTemperature'; time: Date; zoneOffset?: string; temperature: Temperature; measurementLocation: | 'unknown' | 'armpit' | 'finger' | 'forehead' | 'mouth' | 'rectum' | 'temporal_artery' | 'toe' | 'ear' | 'wrist' | 'vagina'; } | { type: 'BasalMetabolicRate'; time: Date; zoneOffset?: string; basalMetabolicRate: Power; } | { type: 'BloodGlucose'; time: Date; zoneOffset?: string; level: BloodGlucose; specimenSource: | 'unknown' | 'interstitial_fluid' | 'capillary_blood' | 'plasma' | 'serum' | 'tears' | 'whole_blood'; mealType: 'unknown' | 'breakfast' | 'lunch' | 'dinner' | 'snack'; relationToMeal: 'unknown' | 'general' | 'fasting' | 'before_meal' | 'after_meal'; } | { type: 'BloodPressure'; time: Date; zoneOffset?: string; systolic: Pressure; diastolic: Pressure; bodyPosition: 'unknown' | 'standing_up' | 'sitting_down' | 'lying_down' | 'reclining'; measurementLocation: 'unknown' | 'left_wrist' | 'right_wrist' | 'left_upper_arm' | 'right_upper_arm'; } | { type: 'BodyFat'; time: Date; zoneOffset?: string; percentage: Percentage; } | { type: 'BodyTemperature'; time: Date; zoneOffset?: string; temperature: Temperature; measurementLocation: 'unknown' | 'armpit' | 'finger' | 'forehead' | 'mouth' | 'rectum' | 'temporal_artery' | 'toe' | 'ear' | 'wrist' | 'vagina'; } | { type: 'HeartRateSeries'; startTime: Date; startZoneOffset?: string; endTime: Date; endZoneOffset?: string; samples: HeartRateSample[]; } | { type: 'Height'; time: Date; zoneOffset?: string; height: Length; } | { type: 'OxygenSaturation'; time: Date; zoneOffset?: string; percentage: Percentage; } | { type: 'RespiratoryRate'; time: Date; zoneOffset?: string; rate: number; } | { type: 'RestingHeartRate'; time: Date; zoneOffset?: string; beatsPerMinute: number; } | { type: 'Steps'; startTime: Date; startZoneOffset?: string; endTime: Date; endZoneOffset?: string; count: number; } | { type: 'Weight'; time: Date; zoneOffset?: string; weight: Mass; }

Energy

{ unit: 'calories' | 'kilocalories' | 'joules' | 'kilojoules'; value: number; }

Temperature

{ unit: 'celsius' | 'fahrenheit'; value: number; }

Power

{ unit: 'kilocaloriesPerDay' | 'watts'; value: number; }

BloodGlucose

{ unit: 'milligramsPerDeciliter' | 'millimolesPerLiter'; value: number; }

Pressure

{ unit: 'millimetersOfMercury'; value: number; }

Percentage

{ value: number; }

HeartRateSample

{ time: Date; beatsPerMinute: number; }

Length

{ unit: 'meter' | 'kilometer' | 'mile' | 'inch' | 'feet'; value: number; }

Mass

{ unit: 'gram' | 'kilogram' | 'milligram' | 'microgram' | 'ounce' | 'pound'; value: number; }

RecordType

'ActiveCaloriesBurned' | 'BasalBodyTemperature' | 'BasalMetabolicRate' | 'BloodGlucose' | 'BloodPressure' | 'BodyFat' | 'BodyTemperature' | 'HeartRateSeries' | 'Height' | 'OxygenSaturation' | 'RespiratoryRate' | 'RestingHeartRate' | 'Steps' | 'Weight'

StoredRecord

RecordBase & Record

RecordBase

{ metadata: RecordMetadata; }

RecordMetadata

{ id: string; clientRecordId?: string; clientRecordVersion: number; lastModifiedTime: Date; dataOrigin: string; }

TimeRangeFilter

{ type: 'before' | 'after'; time: Date; } | { type: 'between'; startTime: Date; endTime: Date; }

Change

{ type: 'Upsert'; record: Record; } | { type: 'Delete'; recordId: string; }