BondState

Represents the bonding (pairing) state of a Bluetooth device.

Bonding is the process of creating a trusted relationship between two Bluetooth devices by exchanging and storing security keys. This enum mirrors the bonding states defined in BluetoothDevice but provides a more Kotlin-idiomatic API.

Bonding vs Pairing

While often used interchangeably, bonding specifically refers to the storage of security keys for future connections, while pairing is the initial key exchange. A bonded device can reconnect securely without requiring user interaction.

Usage Example

val bondState = BondState.fromInt(device.bondState)
when (bondState) {
BondState.BOND_NONE -> initiateBonding()
BondState.BOND_BONDING -> showBondingProgress()
BondState.BOND_BONDED -> proceedWithConnection()
}

See also

Entries

Link copied to clipboard

The device is not bonded (paired) with the local adapter.

Link copied to clipboard

Bonding is currently in progress with the remote device.

Link copied to clipboard

The device is bonded (paired) with the local adapter.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun valueOf(value: String): BondState

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.