abstract class BluetoothGattCallback

This abstract class is used to implement BluetoothGatt callbacks.

Summary

Public constructors
Public methods
open Unit

Callback triggered as a result of a remote characteristic notification.

open Unit

Callback triggered as a result of a remote characteristic notification.

open Unit

onCharacteristicRead(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic, value: ByteArray, status: Int)

Callback reporting the result of a characteristic read operation.

open Unit

Callback reporting the result of a characteristic read operation.

open Unit

Callback indicating the result of a characteristic write operation.

open Unit

onConnectionStateChange(gatt: BluetoothGatt!, status: Int, newState: Int)

Callback indicating when GATT client has connected/disconnected to/from a remote GATT server.

open Unit

onDescriptorRead(gatt: BluetoothGatt!, descriptor: BluetoothGattDescriptor!, status: Int)

Callback reporting the result of a descriptor read operation.

open Unit

onDescriptorRead(gatt: BluetoothGatt, descriptor: BluetoothGattDescriptor, status: Int, value: ByteArray)

Callback reporting the result of a descriptor read operation.

open Unit

Callback indicating the result of a descriptor write operation.

open Unit

onMtuChanged(gatt: BluetoothGatt!, mtu: Int, status: Int)

Callback indicating the MTU for a given device connection has changed.

open Unit

onPhyRead(gatt: BluetoothGatt!, txPhy: Int, rxPhy: Int, status: Int)

Callback triggered as result of BluetoothGatt.readPhy

open Unit

onPhyUpdate(gatt: BluetoothGatt!, txPhy: Int, rxPhy: Int, status: Int)

Callback triggered as result of BluetoothGatt.setPreferredPhy, or as a result of remote device changing the PHY.

open Unit

onReadRemoteRssi(gatt: BluetoothGatt!, rssi: Int, status: Int)

Callback reporting the RSSI for a remote device connection.

open Unit

Callback invoked when a reliable write transaction has been completed.

open Unit

Callback indicating service changed event is received

open Unit

Callback invoked when the list of remote services, characteristics and descriptors for the remote device have been updated, ie new services have been discovered.

open Unit

onSubrateChange(gatt: BluetoothGatt, subrateMode: Int, status: Int)

Callback indicating LE connection's subrate parameters have changed.

Public constructors

BluetoothGattCallback

BluetoothGattCallback()

Public methods

onCharacteristicChanged

open fun onCharacteristicChanged(
    gatt: BluetoothGatt!,
    characteristic: BluetoothGattCharacteristic!
): Unit

Deprecated: Use BluetoothGattCallback.onCharacteristicChanged(BluetoothGatt,BluetoothGattCharacteristic,byte[]) as it is memory safe by providing the characteristic value at the time of notification.

Callback triggered as a result of a remote characteristic notification.

Parameters
gatt BluetoothGatt!: GATT client the characteristic is associated with
characteristic BluetoothGattCharacteristic!: Characteristic that has been updated as a result of a remote notification event.

onCharacteristicChanged

open fun onCharacteristicChanged(
    gatt: BluetoothGatt,
    characteristic: BluetoothGattCharacteristic,
    value: ByteArray
): Unit

Callback triggered as a result of a remote characteristic notification. Note that the value within the characteristic object may have changed since receiving the remote characteristic notification, so check the parameter value for the value at the time of notification.

Parameters
gatt BluetoothGatt: GATT client the characteristic is associated with.
This value cannot be null.
characteristic BluetoothGattCharacteristic: Characteristic that has been updated as a result of a remote notification event.
This value cannot be null.
value ByteArray: notified characteristic value.
This value cannot be null.

onServiceChanged

open fun onServiceChanged(gatt: BluetoothGatt): Unit

Callback indicating service changed event is received

Receiving this event means that the GATT database is out of sync with the remote device. BluetoothGatt.discoverServices should be called to re-discover the services.

Parameters
gatt BluetoothGatt: GATT client involved.
This value cannot be null.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-02-26 UTC.