# Bluetooth hooks

Canonical page: https://docs.ovok.com/native-sdk/guide/components/bt-management/hooks

Import Bluetooth hooks from `@ovok/native/bt-management`. Runtime hooks must render beneath `BTProvider`; they read the runtime owned by that provider.

## Runtime hooks [#runtime-hooks]

| Hook | Returns | Use it for |
| --- | --- | --- |
| `useNearbyDevices()` | `devices` and `pair(id)` | Read discovered managed devices and connect to a device by its runtime ID. |
| `useBluetoothState({ bleManager?, requestPermission? })` | `state`, `permissionStatus`, `requestPermission()`, and `openSettings()` | Observe Bluetooth state and request access from an app-owned action. It does not request permission on mount. |
| `usePairedDevices({ storage, storageKey?, autoPair? })` | `paired`, `pair(device)`, and `forget(id)` | Persist remembered device IDs with app-supplied async key-value storage. |
| `useDeviceConnection(id)` | `status` and recent `events` | Observe one device's status and connection events. |
| `useMeasurements(onResult?, options?)` | `measurements` and `clear()` | Collect recent results in component state, deduplicated by result ID. |
| `useScanControl()` | `canControl`, `pauseScan()`, and `resumeScan()` | Pause and resume the provider's scan without unmounting it. |
| `useOpenSeries(manager)` | the series being recorded, each with its `latest` values | Show a streaming device's values before its series is stored. Works with any `BTManager`, inside or outside `BTProvider`. |
| `useQueuedResults(coordinator)` | the current account's results still waiting | Show readings that are not saved yet, from a `BackgroundSyncCoordinator`. |
| `useRuntimeEvent(event, callback)` | — | Subscribe to a typed runtime event for a focused integration. |
| `useBluetoothRuntime()` | runtime object | Advanced access to the underlying provider runtime. Prefer the focused hooks above. |

`usePairedDevices` persists device IDs, not credentials. The default storage key is `@ovok/native/paired-devices`. Supply storage backed by your app's secure or durable storage policy, and call `forget` when the user removes a device.

`useMeasurements` supports the policies `all`, `daily-totals-only`, and `first-reading-per-kind-per-connection`. Its in-memory list is capped by `maxResults` (default 100). For durable application records, persist results from `BTProvider.onResult`.

## Hooks that can run outside BTProvider [#hooks-that-can-run-outside-btprovider]

- `useRequestPermissions({ onAccessPermissionChanged? })` requests the platform permission used by `BTProvider` and reports whether access was granted.
- `useHealthImport` is a separate health-data integration hook; see the [health data guide](/native-sdk/guide/modules/data-sync).

The raw runtime context hook is exported for advanced integrations. Components using it should still be rendered beneath the provider; it throws if no Bluetooth runtime is available.

See [BTProvider](/native-sdk/guide/components/bt-management/bt-provider/) and the [Bluetooth guide](/native-sdk/guide/modules/bt-management).
