# AndroidHealthSync

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

Render this component inside an
[`AndroidHealthConnectAuthorizationProvider`](/native-sdk/guide/components/data-sync/android/health-connect-authorization-provider/)
to import the requested Health Connect record types. It starts the import when
mounted and renders no visible UI.

~~~tsx
import { DataSync } from "@ovok/native/data-sync";

<DataSync.AndroidHealthConnectAuthorizationProvider
  readIdentifiers={["Weight", "Steps"]}
>
  <DataSync.AndroidHealthSync
    dataToSync={androidDataToSync}
    chunkSize={250}
    onProgress={setProgress}
    onError={handleSyncError}
  />
</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).

## Behavior [#behavior]

- The component uses the active native `Ovok` client and Patient session from
  `@ovok/core/next/react` context. Mount it after sign-in.
- A first import reads the most recent 30 days by default. Set `minDate` when
  the feature needs an earlier initial boundary.
- Existing observations and Health Connect page tokens guide later reads. The
  native client's secure storage keeps page tokens across app restarts per patient
  and project.
- Progress updates include `idle`, `started`, `syncing`, `paused`,
  `failed`, or `completed`; pause reasons are `offline` and `wifi-only`.
- Offline connectivity pauses the service. `wifiOnly` also pauses it on
  cellular, then the service resumes when the network meets the policy.

For imports after the app process stops, use the headless task API in
[`@ovok/native/background-sync`](/native-sdk/guide/modules/background-sync) rather than
mounting this React component in a headless task. The task requires a restored
client, patient ID, and mapping.

## Related [#related]

- [Health Connect authorization provider](/native-sdk/guide/components/data-sync/android/health-connect-authorization-provider/)
- [SyncProgressList](/native-sdk/guide/components/data-sync/sync-progress-list/)
- [HealthKit and Health Connect guide](/native-sdk/guide/modules/data-sync)
- [Background sync](/native-sdk/guide/modules/background-sync)
