Skip to main content

NearbyDevicePrompt

Mount NearbyDevicePrompt inside BTProvider to offer one accepted nearby device at a time. The prompt never connects until the person taps “Yes, pair it”. Without mounting it, the SDK behaves as before.

import { NearbyDevicePrompt } from "@ovok/native/ui";

<NearbyDevicePrompt
storage={pairedDeviceStorage}
enabled={!pairingPageIsOpen}
hint="Hold the monitor button until the pairing symbol appears."
onPaired={(device) => analytics.track("device_paired", { id: device.id })}
/>

Not mine persists the device ID under ${storageKey}.declined-nearby-devices (or declinedStorageKey when supplied). Later skips it for the current Bluetooth provider session without writing storage. Devices already remembered by usePairedDevices and declined IDs are not offered. If a connection fails, the dialog shows the same device-neutral, Bluetooth-error-code keyed copy as PairingFlow, with a retry button. The component is foreground UI and does not change background synchronization.

The headless useNearbyDeviceOffer hook provides the same offer, actions, status, and typed BluetoothError without rendering UI.

PropTypeDescription
storagePairedDeviceStorageRequired persistence adapter used for remembered and declined device IDs.
storageKeystringPairing key used by usePairedDevices; defaults to @ovok/native/paired-devices.
declinedStorageKeystringOptional key for persisted “Not mine” device IDs.
enabledbooleanSuppress the prompt while the app is showing its own pairing UI. Defaults to true.
hintstringOptional app-owned device-specific pairing instruction.
labelsRecord<string, string>Override title, pair, notMine, later, retry, pairing, hint, and Bluetooth error-code copy.
onPaired(device: RuntimeDevice) => voidCalled after connection and pairing storage succeed.
onError(error: Error, device?: RuntimeDevice) => voidCalled after a connection or persistence error.
theme, slots, testIDshared UI propsOptional theme, primitive overrides, and test ID.

The hook is exported from @ovok/native/bt-management; the prompt is exported from @ovok/native/ui.