DataSync
@ovok/native/data-sync contains the native health authorization and import
components for iOS HealthKit and Android Health Connect. The platform provider
requests permissions; the matching sync component reads records and writes mapped
observations through the active OVOK client.
Start with the HealthKit and Health Connect guide for native setup, data mapping, and an end-to-end flow. Use this page to find the component and type references.
Import the module
import { DataSync, SyncProgressList } from "@ovok/native/data-sync";
The subpath keeps platform health libraries out of apps that do not use health
imports. Mount the app under OvokProvider and render sync components only when
the client and patient profile are ready.
Components
| Component | Purpose |
|---|---|
DataSync | Compound API that exposes the platform providers, sync components, and manual request sheet as static members. |
AppleHealthAuthorizationProvider | Requests HealthKit access and reports request state. |
AppleHealthSync | Imports mapped samples from HealthKit. |
AndroidHealthConnectAuthorizationProvider | Initializes Health Connect, requests permissions, and refreshes state when the app becomes active. |
AndroidHealthSync | Imports mapped records from Health Connect. |
SyncProgressList | Renders per-type status, counts, and progress bars. |
ManuallyRequestSheet | Compound bottom-sheet UI for an app-owned permission prompt, with six documented subcomponents. |
For an adapter-driven permission card, see HealthImportCard.
It does not invoke the DataSync provider import pipeline.
Exported types
The module also exports:
AppleHealthSyncPropsandAndroidHealthSyncProps;AppleHealthAuthorizationStatusandAndroidHealthConnectAuthorizationStatus;HealthSyncKey,HealthSyncKeys,HealthDataType, andHealthDataMode;SyncProgressandSyncPauseReason;SyncProgressListProps.
Use the platform-specific props type when declaring a reusable mapping:
import type { AppleHealthSyncProps } from "@ovok/native/data-sync";
const dataToSync: AppleHealthSyncProps["dataToSync"] = {
// Add only the measurement keys and HealthKit identifiers the feature needs.
};
Runtime behavior
- Imports start when the platform sync component mounts.
- Both platform providers default to requesting access automatically. Pass a manual
request renderer and
skipRequest={false}when the app owns the prompt. - Each sync uses
dataToSyncto map source identifiers to observation codes. - The default provider read chunk is 250 records.
- Network loss pauses work.
wifiOnlycan also pause it on cellular data. - HealthKit observer delivery and Android headless Health Connect work are configured separately; see background sync.