# onConnectionEvent

Canonical page: https://docs.ovok.com/native-sdk/guide/components/bt-management/bt-provider/on-connection-event

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

~~~tsx
<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`.

| Field | Meaning |
| --- | --- |
| `deviceData` | The peripheral associated with the event. |
| `pairingCodeRequired` | Present on pairing events when the platform expects user confirmation or a code. |
| `progress.current` | Number of history items reported so far. |
| `progress.total` | Optional total from the device protocol. Do not calculate a percentage when it is absent. |
| `batteryLevel` | Battery 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](/native-sdk/guide/components/ui/pairing-flow) for a reusable pairing UI.
