Skip to main content

BackgroundSyncSetting

Presents the useBackgroundSync toggle and its on, off, restricted, or blocked status.

<BackgroundSyncSetting
canEnable={platformPolicy.allowsBluetoothBackground}
onEnabledChange={savePreference}
/>

Props​

Accepts UseBackgroundSyncOptions plus:

  • title?: string.
  • description?: ReactNode — defaults to platform-specific background-work copy.
  • statusLabels?: Partial<Record<"on" | "off" | "restricted" | "blocked", string>>.
  • reasonLabels?: Partial<Record<string, string>>.
  • testID?: string.
  • theme? and slots? — shared OvokUiProps.

canEnable and onEnabledChange remain app policy hooks. Enabling this setting only changes the Bluetooth manager's background-scan flag; it is not a queue, scheduler, upload worker, credential store, or guarantee that the operating system will wake the app. Configure native requirements separately in the background-sync guide. The displayed switch is only the hook's local state. It does not read whether the provider-owned durable background queue is active; persist the setting and feed the same value into BTProvider.backgroundSync.enabled when both APIs are used. If canEnable rejects, the hook does not catch that rejection or render a blocked state, so return false rather than throwing from that predicate.