Skip to main content

onConnectionEvent

Use onConnectionEvent for connection details that do not fit the compact DeviceStatus enum.

<BTProvider
{...providerProps}
onConnectionEvent={(event) => {
if (event.kind === "history-download") {
updateHistoryProgress(event.progress?.current, event.progress?.total);
}
if (event.kind === "battery") {
updateBattery(event.batteryLevel);
}
}}
/>

kind is pairing, bonded, history-download, or battery.

FieldMeaning
deviceDataThe peripheral associated with the event.
pairingCodeRequiredPresent on pairing events when the platform expects user confirmation or a code.
progress.currentNumber of history items reported so far.
progress.totalOptional total from the device protocol. Do not calculate a percentage when it is absent.
batteryLevelBattery percentage when the device exposes the standard Battery Service.

The callback runs alongside the SDK runtime event stream used by PairingFlow and Bluetooth hooks. Do not interpret a bonded event as a completed health measurement; readings arrive through onResult.

See PairingFlow for a reusable pairing UI.