bondDevice

Initiates bonding with the specified Bluetooth device and returns a Flow of bond state updates.

If the device is not already bonded (BluetoothDevice.BOND_NONE), this method will initiate the bonding process by calling BluetoothDevice.createBond. The returned Flow will emit BondState updates as the bonding progresses.

The Flow will automatically complete (close) when bonding reaches a terminal state:

Important Notes

  • The bonding process may trigger a system pairing dialog for user confirmation

  • The Flow uses a BroadcastReceiver internally, which is automatically unregistered when the Flow collection is cancelled or completes

  • Only one bonding operation should be active per device at a time

Return

A Flow emitting BondState updates. The flow completes when bonding reaches a terminal state (bonded or failed).

Parameters

device

The BluetoothDevice to bond with.

See also

Throws