# AndroidHealthConnectAuthorizationProvider

Canonical page: https://docs.ovok.com/native-sdk/guide/components/data-sync/android/health-connect-authorization-provider

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.

~~~tsx
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 [#props]

Every prop, with its type and description, is listed in the [`@ovok/native/data-sync` API reference](/native-sdk/reference/data-sync).

## Status [#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 [#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](/native-sdk/guide/modules/background-sync).

See [installation and native setup](/native-sdk/guide/how-to/installation) and the
[HealthKit and Health Connect guide](/native-sdk/guide/modules/data-sync).
