AndroidHealthConnectAuthorizationProvider
Initialize Health Connect and request its permissions
- Stable unknown
- Release candidate since 1.16.1-rc.3
- Development since 1.16.1-dev.2111+9796905
Wrap an Android import screen with this provider to initialize Health Connect, request the record permissions the feature needs, and re-check access whenever the app returns to the foreground.
import { ActivityIndicator } from "react-native";
import { DataSync } from "@ovok/native/data-sync";
<DataSync.AndroidHealthConnectAuthorizationProvider
readIdentifiers={["Weight", "Steps"]}
fallback={<ActivityIndicator />}
onAuthorizationStatusChange={setHealthConnectStatus}
>
<DataSync.AndroidHealthSync dataToSync={androidDataToSync} />
</DataSync.AndroidHealthConnectAuthorizationProvider>;Props
Every prop, with its type and description, is listed in the @ovok/native/data-sync API reference.
Status
The root state can be unknown, shouldRequest, requesting,
authorized, refused, or error. An optional error explains
initialization or permission failures.
When backgroundAccess is true, the separate backgroundAccess status can be
authorized, shouldRequest, refused, or unsupported. Background
access is independent of foreground permissions; declining it does not block
foreground reads.
Use the status callback to distinguish a missing permission from unavailable Health Connect. Declare the matching Android manifest permissions as part of the native build; runtime requests cannot add missing manifest declarations.
Native setup
Enable the SDK's healthConnect config plugin and add only the
android.permission.health.READ_* and optional WRITE_* permissions that
match the configured record types. For scheduled background imports, also configure
the Android background service and headless task described in
background sync.
See installation and native setup and the HealthKit and Health Connect guide.
Last updated on