GuidesComponentsApp UI components

HealthImportCard

Show health access status and request access through an app adapter

  • Stable unknown
  • Release candidate since 1.16.1-rc.3
  • Development since 1.16.1-dev.2111+9796905

HealthImportCard renders health-access state and per-type status for an app-provided HealthImportAdapter. It can also display optional SyncProgress values. Import the component from @ovok/native/ui and the adapter type from @ovok/native/bt-management.

import { HealthImportCard } from "@ovok/native/ui";
import type { HealthImportAdapter } from "@ovok/native/bt-management";

type HealthType = "steps" | "weight";

const adapter: HealthImportAdapter<HealthType> = {
  getStatus: async (type) => readPermissionStatus(type),
  request: async (types, background) => {
    await requestAppHealthAccess(types, { background });
  },
};

<HealthImportCard
  types={["steps", "weight"]}
  adapter={adapter}
  background
  labelForType={(type) => healthTypeLabels[type]}
/>

This is an adapter-driven UI component. It does not configure HealthKit or Health Connect, and it does not start the SDK's DataSync import pipeline. For those integrations, see DataSync and the HealthKit and Health Connect guide.

Props

Every prop, with its type and description, is listed in the @ovok/native/ui API reference.

Status and request behavior

The component calls getStatus for each listed type on mount and after a successful request. It shows these built-in labels:

Adapter statusDisplayed state
authorizedUp to date
shouldRequestWaiting for permission
refusedNot shared
unsupportedUnavailable on this device
No status yetChecking access

The card is enabled only when every listed type is authorized. It marks refused types with an additional notice. If getStatus fails, the card displays the error and keeps that type's previous status, if one was already available.

Turning the card on calls adapter.request(types, background) and refreshes the statuses when the promise resolves. Turning it off only changes local UI state. The adapter contract has no revoke, stop, or cancel method, so switching off does not revoke OS permission or stop an app-owned import service. The card does not subscribe to permission changes made elsewhere; refresh or remount it from app-owned state when access may have changed in system settings.

The built-in copy goes through react-i18next with the English text above as the default, so it renders unchanged until your app adds these keys to its locale resources:

KeyDefault
health-import-card.titleHealth data import
health-import-card.status.authorizedUp to date
health-import-card.status.shouldRequestWaiting for permission
health-import-card.status.refusedNot shared
health-import-card.status.unsupportedUnavailable on this device
health-import-card.status.checkingChecking access
health-import-card.not-sharedSome data types are not shared. You can enable them in your health app.
health-import-card.connectConnect health data
health-import-card.stopStop import

An explicit title prop still wins over the translated title. statusLabels and reasonLabels customize only the nested sync-progress list; type names come from labelForType.

See Reusable flows for the app integration boundary.

Last updated on

On this page