# BluetoothPairingCallback

# BluetoothPairingCallback

`
public


interface
BluetoothPairingCallback
`  
`


`

|--------------------------------------------------------------|
| com.google.android.things.bluetooth.BluetoothPairingCallback |

<br />

*** ** * ** ***

This callback is invoked during the Bluetooth pairing process and contains all the relevant pairing information required for pairing.

## Summary

|                                                                             ### Nested classes                                                                              ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` class` | [BluetoothPairingCallback.PairingError](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothPairingCallback.PairingError) <br /> |

|                                                                                                                                                                                                                                                                                                      ### Public methods                                                                                                                                                                                                                                                                                                       ||
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` default void` | ` `[onPaired](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothPairingCallback#onPaired(android.bluetooth.BluetoothDevice))`(`[BluetoothDevice](https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html)` bluetoothDevice) ` Invoked when successfully paired with a device.                                                                                                                                                                                                                                                                      |
| ` default void` | ` `[onPairingError](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothPairingCallback#onPairingError(android.bluetooth.BluetoothDevice, com.google.android.things.bluetooth.BluetoothPairingCallback.PairingError))`(`[BluetoothDevice](https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html)` bluetoothDevice, `[BluetoothPairingCallback.PairingError](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothPairingCallback.PairingError)` error) ` Invoked when pairing with a device is cancelled or fails. |
| ` default void` | ` `[onPairingInitiated](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothPairingCallback#onPairingInitiated(android.bluetooth.BluetoothDevice, com.google.android.things.bluetooth.PairingParams))`(`[BluetoothDevice](https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html)` bluetoothDevice, `[PairingParams](https://developer.android.com/reference/com/google/android/things/bluetooth/PairingParams)` pairingParams) ` Pairing callback invoked when pairing process has been initiated with a remote Bluetooth device.                  |
| ` default void` | ` `[onUnpaired](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothPairingCallback#onUnpaired(android.bluetooth.BluetoothDevice))`(`[BluetoothDevice](https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html)` bluetoothDevice) ` Invoked when the pairing with an existing device is removed.                                                                                                                                                                                                                                                     |

## Public methods

### onPaired

```
void onPaired (BluetoothDevice bluetoothDevice)
```

Invoked when successfully paired with a device.

<br />

|                                     Parameters                                     ||
|-------------------|-----------------------------------------------------------------|
| `bluetoothDevice` | `BluetoothDevice`: remote Bluetooth device to pair with. <br /> |

### onPairingError

```
void onPairingError (BluetoothDevice bluetoothDevice, 
                BluetoothPairingCallback.PairingError error)
```

Invoked when pairing with a device is cancelled or fails.

<br />

|                                     Parameters                                     ||
|-------------------|-----------------------------------------------------------------|
| `bluetoothDevice` | `BluetoothDevice`: remote Bluetooth device to pair with. <br /> |
| `error`           | `BluetoothPairingCallback.PairingError` <br />                  |

### onPairingInitiated

```
void onPairingInitiated (BluetoothDevice bluetoothDevice, 
                PairingParams pairingParams)
```

Pairing callback invoked when pairing process has been initiated with a remote Bluetooth device.

<br />

|                                                 Parameters                                                 ||
|-------------------|-----------------------------------------------------------------------------------------|
| `bluetoothDevice` | `BluetoothDevice`: remote Bluetooth device to pair with. <br />                         |
| `pairingParams`   | `PairingParams`: parameters of the pairing attempt such as type and passkey etc. <br /> |

### onUnpaired

```
void onUnpaired (BluetoothDevice bluetoothDevice)
```

Invoked when the pairing with an existing device is removed.

<br />

|                                     Parameters                                     ||
|-------------------|-----------------------------------------------------------------|
| `bluetoothDevice` | `BluetoothDevice`: remote Bluetooth device to pair with. <br /> |

-

  ## Interfaces

  - [BluetoothConnectionCallback](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothConnectionCallback)
  - [BluetoothPairingCallback](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothPairingCallback)
-

  ## Classes

  - [BluetoothClassFactory](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothClassFactory)
  - [BluetoothConfigManager](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothConfigManager)
  - [BluetoothConnectionManager](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothConnectionManager)
  - [BluetoothPairingCallback.PairingError](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothPairingCallback.PairingError)
  - [BluetoothProfile](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothProfile)
  - [BluetoothProfileManager](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothProfileManager)
  - [ConnectionParams](https://developer.android.com/reference/com/google/android/things/bluetooth/ConnectionParams)
  - [PairingParams](https://developer.android.com/reference/com/google/android/things/bluetooth/PairingParams)