Bluetooth management
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
BTProvider requests permissions and displays a permission fallback when access is missing. Once access is granted and acceptedDevices is non-empty, the provider creates BTManager, installs its callbacks, and begins scanning. 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.