Bluetooth management
Public Bluetooth runtime, provider, hooks, device definitions, and UI entry points.
- Stable unknown
- Release candidate since 1.16.1-rc.3
- Development since 1.16.1-dev.2111+9796905
The Bluetooth module is the runtime and protocol layer behind BLE discovery and measurement delivery. Its public React entry point is BTProvider; its SDK subpath is @ovok/native/bt-management.
Choose an entry point
| Need | API |
|---|---|
| Start a BLE session | BTProvider with a stable BleManager and an acceptedDevices tuple |
| Respond to discovery and readings | onDeviceFound, onDeviceStatusChanged, onConnectionEvent, onResult, and onError |
| Ask users to choose among discoveries | autoConnect, onDeviceSelectionRequired, and BluetoothDevicePicker |
| Inspect runtime state in a component | useNearbyDevices, useDeviceConnection, useMeasurements, useScanControl, and useRuntimeEvent |
| Remember pairings | usePairedDevices with app-provided key-value storage |
| Use an SDK protocol | IntegratedDevices or an entry from SUPPORTED_DEVICES |
| Add a new protocol | defineCustomDevice and a custom device declaration |
| Deliver readings while backgrounded | backgroundSync configuration and native setup |
Runtime lifecycle
By default, BTProvider requests permissions on mount and starts discovery when acceptedDevices is non-empty. Set gateOnPermission to keep children from rendering until the automatic request resolves; a denied request then shows the permission fallback. Set requestPermissionOnMount={false} to keep the provider mounted but wait for an app-triggered request through useBluetoothState().requestPermission(). The manager is destroyed when the provider unmounts or its core configuration changes.
Keep both the BleManager and acceptedDevices stable. Recreating either during render can restart a session. The provider owns scanning and managed device subscriptions; application code owns the manager object, result persistence, patient association, and application-specific UI.
Component and API reference
- BTProvider — session lifecycle and props.
- BluetoothDevicePicker — chooser for multiple auto-connect candidates.
- BluetoothRuntimeProvider — low-level runtime context primitive.
- DefaultPermissionFallback — default settings prompt used by the provider.
- Provider callbacks — discovery, status, connection events, results, errors, and permission changes.
- Runtime hooks — access nearby devices, statuses, results, scan control, and pairing storage.
- Advanced Bluetooth usage — direct manager ownership, runtime composition, and BLE fixtures.
- Device types and protocols — built-in keys, decodable profiles, and custom protocol boundaries.
- Bluetooth services — the public session and protocol surface.
- Supported devices — catalog definitions and accepted-device entries.
- Custom devices — declare a supported GATT and measurement protocol.
- Types — device, event, error, result, and declaration types.
- PairingFlow, BluetoothStateNotice, and SupportedDevicesCatalogList — reusable UI integrations from
@ovok/native/ui. - Bluetooth device UI — device list, row, catalog, and manual components.
For an end-to-end flow, start with the Bluetooth guide.
Last updated on