01Availability
| Function | Returns | Description |
|---|---|---|
isHealthConnectAvailable() | Promise<HealthConnectAvailability> | Whether Health Connect is usable |
getHealthConnectAvailability() | Promise<HealthConnectAvailabilityInfo> | Detailed status and advice |
openHealthConnectApp() | void | Open Health Connect or the Play Store |
openHealthConnectSettings() | void | Open Health Connect settings |
openHealthConnectDataManagement(pkg?) | void | Open permission management |
checkLibraryUpdate(options?) | Promise<LibraryUpdateInfo> | Compare against GitHub Releases |
LIBRARY_VERSION | string | Installed package version |
02Permissions & helpers
| Function | Returns | Description |
|---|---|---|
requestPermissions(perms) | Promise<string[]> | Show the permission dialog |
checkPermissions(perms) | Promise<string[]> | Which are granted |
hasPermissions(perms) | Promise<boolean> | True when all are granted |
missingPermissions(perms) | Promise<string[]> | The subset not granted |
ensurePermissions(perms, opts?) | Promise<EnsurePermissionsResult> | Request missing, then re-check |
ensureAvailable(opts?) | availability | Gate; opens the store when not installed |
revokeAllPermissions() | Promise<void> | Revoke everything |
Permission.* | HealthPermission | Typed constants, e.g. Permission.READ_STEPS |
timeRangeToday(), timeRangeLastDays(), timeRangeLastHours() | TimeRangeFilter | Instant windows |
now() / HealthInstant | ISO Instant / range | Carbon-style now().subHours(1).toISOString(), .until(now()) |
pollUntil, waitUntil | result / T | Soft poll; waitUntil throws on timeout |
useForegroundPoll, pollOnForeground | hook / controller | Poll on mount and on every resume |
waitForRecords, readAllRecords, pullChanges | paged helpers | Wait for rows, drain pages, changelog loop |
03Records
| Function | Description |
|---|---|
readRecords<T>(type, options) | Generic paged read |
writeRecords(records) | Insert |
updateRecords(records) | Update; needs metadata.id from a prior read |
deleteRecordsByTime, deleteRecordsById | Delete |
aggregateRecord, aggregateGroupByDuration, aggregateGroupByPeriod | Totals, Instant buckets, calendar buckets |
getChangesToken, getChanges | Changelog sync; tokens last about 30 days |
requestExerciseRoute(recordId) | Consent UI when a route is CONSENT_REQUIRED |
readSteps, readHeartRate, … | One helper per record type (42 types) |
04React hooks
Each hook fetches on mount, on every foreground resume and when its
arguments change, and ignores results after unmount. Data hooks return
HealthQueryState<T>: { value, satisfied, loading, error, refresh },
and accept enabled, ready, timeoutMs and
intervalMs. See the React hooks guide.
| Hook | Returns | Description |
|---|---|---|
useHealthConnectAvailability(opts?) | HealthQueryState<HealthConnectAvailability> | Availability, re-checked on resume |
useHealthConnectPermissions(perms, opts?) | [HealthQueryState<EnsurePermissionsResult>, request] | Granted / missing status, plus request() for the missing ones |
useReadRecords<T>(type, opts?) | HealthQueryState<ReadRecordsResponse<T>> | One page of records; timeRangeFilter may be a function |
useMostRecentRecord<T>(type, opts?) | HealthQueryState<T | null> | Newest record in the window (default: last 30 days) |
useAggregate(type, range, opts?) | HealthQueryState<AggregateResult> | Aggregate metrics; range may be a function |
useChanges(token, opts?) | HealthQueryState<PullChangesResult> | Changelog sync; continues from nextChangesToken, reports via onChanges |
05Features, Matchmaking, PHR
Check getFeatureStatus before calling any of these.
| Function | Description |
|---|---|
getFeatureStatus(Feature.*) | FeatureStatus.AVAILABLE or UNAVAILABLE |
Feature / FeatureStatus / Availability | Typed constants (no hand-typed feature / status strings) |
FhirVersion.R4 | PHR fhirVersion: { major: 4, minor: 0, patch: 1 } |
checkIfMatchmakingIsPossible, launchMatchmaking | Matchmaking UI |
createMedicalDataSource, getMedicalDataSources | FHIR data sources |
upsertMedicalResources, readMedicalResources, deleteMedicalResources | Medical resources |