AndroidHealthSync
Render this component inside an
AndroidHealthConnectAuthorizationProvider
to import the requested Health Connect record types. It starts the import when
mounted and renders no visible UI.
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
| Prop | Required | Default | Description |
|---|---|---|---|
dataToSync | Yes | — | Maps HealthSyncKey values to Health Connect record types and observation codes. |
chunkSize | No | 250 | Maximum source records read in a provider page. |
wifiOnly | No | false | Pause when the device is connected over a non-Wi-Fi network. |
onProgress | No | — | Receive the partial per-key progress map. |
onError | No | — | Receive an Error, FHIR Bundle<Resource>, or null. |
Each dataToSync value contains typeIdentifiers, an optional minDate,
and an optional mode. The same record types must be included in the
authorization provider's readIdentifiers and the Android native manifest
permissions.
Behavior
- The component uses the active
OvokClientand patient profile from@ovok/corecontext. Mount it after both are ready. - A first import reads the most recent 30 days by default. Set
minDatewhen the feature needs an earlier initial boundary. - Existing observations and Health Connect page tokens guide later reads. Configure client storage if page tokens should survive app restarts.
- Progress updates include
idle,started,syncing,paused,failed, orcompleted; pause reasons areofflineandwifi-only. - Offline connectivity pauses the service.
wifiOnlyalso 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 rather than
mounting this React component in a headless task. The task requires a restored
client, patient ID, and mapping.