# BackgroundSyncSetting

Canonical page: https://docs.ovok.com/native-sdk/guide/components/ui/background-sync-setting

`BackgroundSyncSetting` is a themed switch for Bluetooth background scanning. Render
it beneath `BTProvider`, where `useBackgroundSync` can reach the active Bluetooth
runtime:

~~~tsx
import { useState } from "react";
import { BackgroundSyncSetting } from "@ovok/native/ui";
import { BTProvider } from "@ovok/native/bt-management";

function MonitoringSettings() {
  const [backgroundEnabled, setBackgroundEnabled] = useState(false);

  return (
    <BTProvider
      bleManager={bleManager}
      acceptedDevices={acceptedDevices}
      backgroundSync={{
        enabled: backgroundEnabled,
        storage: measurementStorage,
        onResult: uploadMeasurement,
      }}
    >
      <BackgroundSyncSetting
        enabled={backgroundEnabled}
        canEnable={platformPolicy.allowsBluetoothBackground}
        onEnabledChange={async (enabled) => {
          setBackgroundEnabled(enabled);
          await saveBackgroundPreference(enabled);
        }}
      />
    </BTProvider>
  );
}
~~~

The app owns the preference. Pass its current value to both the setting and
`BTProvider.backgroundSync.enabled`, and persist changes in `onEnabledChange`. The
setting's `enabled` prop initializes its local switch state; it does not subscribe to
later prop changes. Keep the two values in sync from app-owned state.

## Props [#props]

Every prop, with its type and description, is listed in the [`@ovok/native/ui` API reference](/native-sdk/reference/ui).

## Related [#related]

- [`BTProvider`](/native-sdk/guide/components/bt-management/bt-provider/) — Bluetooth session and queue configuration.
- [Background sync APIs](/native-sdk/guide/components/background-sync/) — Android services, headless work, and helpers.
