Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/bluetooth/BluetoothGatt#constants) \| [Inherited Constants](https://developer.android.com/reference/android/bluetooth/BluetoothGatt#inhconstants) \| [Methods](https://developer.android.com/reference/android/bluetooth/BluetoothGatt#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/bluetooth/BluetoothGatt#inhmethods)

# BluetoothGatt

*** ** * ** ***


`
public

final

class
BluetoothGatt
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/android/bluetooth/BluetoothProfile


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.bluetooth.BluetoothGatt |

<br />

*** ** * ** ***

Public API for the Bluetooth GATT Profile.

This class provides Bluetooth GATT functionality to enable communication with Bluetooth Smart
or Smart Ready devices.

To connect to a remote peripheral device, create a `https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback` and call
`https://developer.android.com/reference/android/bluetooth/BluetoothDevice#connectGatt(android.bluetooth.BluetoothGattConnectionSettings,%20java.util.concurrent.Executor,%20android.bluetooth.BluetoothGattCallback)` to get a instance of this class. GATT capable devices can be
discovered using the Bluetooth device discovery or BLE scan process.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_BALANCED` Connection parameter update - Use the connection parameters recommended by the Bluetooth SIG. |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_DCK` Connection parameter update - Request the priority preferred for Digital Car Key for a lower latency connection. |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_HIGH` Connection parameter update - Request a high priority, low latency connection. |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_LOW_POWER` Connection parameter update - Request low power, reduced data rate connection parameters. |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_CONNECTION_CONGESTED` A remote device connection is congested. |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_CONNECTION_TIMEOUT` GATT connection timed out, likely due to the remote device being out of range or not advertising as connectable. |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_FAILURE` A GATT operation failed, errors other than the above |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_INSUFFICIENT_AUTHENTICATION` Insufficient authentication for a given operation |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_INSUFFICIENT_AUTHORIZATION` Insufficient authorization for a given operation |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_INSUFFICIENT_ENCRYPTION` Insufficient encryption for a given operation |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_INVALID_ATTRIBUTE_LENGTH` A write operation exceeds the maximum length of the attribute |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_INVALID_OFFSET` A read or write operation was requested with an invalid offset |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_READ_NOT_PERMITTED` GATT read operation is not permitted |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_REQUEST_NOT_SUPPORTED` The given request is not supported |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_SUCCESS` A GATT operation completed successfully |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_WRITE_NOT_PERMITTED` GATT write operation is not permitted |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#SUBRATE_MODE_BALANCED` Connection subrate mode - Requests to enable subrate mode using balanced parameters to provide a compromise between power savings and performance. |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#SUBRATE_MODE_HIGH` Connection subrate mode - Requests to enable subrate mode with parameters optimized for high burstiness, enhanced data transfer. |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#SUBRATE_MODE_LOW` Connection Subrate mode - Requests to enable subrate mode with parameters optimized for low burstiness, minimum power consumption. |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#SUBRATE_MODE_NOT_UPDATED` Connection Subrate mode - No Update applied due to error. |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#SUBRATE_MODE_OFF` Connection Subrate mode - Request to disable subrate mode. |
| `int` | `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#SUBRATE_MODE_SYSTEM_UPDATE` Connection Subrate mode - System Update. |

### Inherited constants

From interface `https://developer.android.com/reference/android/bluetooth/BluetoothProfile` `int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#A2DP`

Advanced Audio Distribution Profile (A2DP)


`int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#CSIP_SET_COORDINATOR`

Coordinated Set Identification Profile (CSIP) set coordinator


`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#EXTRA_PREVIOUS_STATE`

Extra for the connection state intents of the individual profiles.


`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#EXTRA_PROFILE`

Extra for the `https://developer.android.com/reference/android/bluetooth/BluetoothProfile` that the intent applies to.


`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#EXTRA_STATE`

Extra for the connection state intents of the individual profiles.


`int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#GATT`

Generic Attribute Profile (GATT)


`int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#GATT_SERVER`

Generic Attribute Profile (GATT) Server


`int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#HAP_CLIENT`


`int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#HEADSET`

Headset and Handsfree profile


`int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#HEALTH`

*This constant was deprecated
in API level 29.
Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should
use Bluetooth Low Energy based solutions such as `https://developer.android.com/reference/android/bluetooth/BluetoothGatt`, `https://developer.android.com/reference/android/bluetooth/BluetoothAdapter#listenUsingL2capChannel()`, or `https://developer.android.com/reference/android/bluetooth/BluetoothDevice#createL2capChannel(int)`*


`int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#HEARING_AID`

Hearing Aid Device


`int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#HID_DEVICE`

Human Interface Device (HID) Device


`int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#LE_AUDIO`

LE Audio Device


`int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#SAP`

SIM Access Profile (SAP)


`int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_CONNECTED`

The profile is in connected state


`int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_CONNECTING`

The profile is in connecting state


`int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_DISCONNECTED`

The profile is in disconnected state


`int` `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_DISCONNECTING`

The profile is in disconnecting state


| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#abortReliableWrite(android.bluetooth.BluetoothDevice)(https://developer.android.com/reference/android/bluetooth/BluetoothDevice mDevice) ` *This method was deprecated in API level 19. Use `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#abortReliableWrite()`* |
| ` void` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#abortReliableWrite()() ` Cancels a reliable write transaction for a given device. |
| ` boolean` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#beginReliableWrite()() ` Initiates a reliable write transaction for a given remote device. |
| ` void` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#close()() ` Close this Bluetooth GATT client. |
| ` boolean` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#connect()() ` Connect back to remote device. |
| ` void` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#disconnect()() ` Disconnects an established connection, or cancels a connection attempt currently in progress. |
| ` boolean` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#discoverServices()() ` Discovers services offered by a remote device as well as their characteristics and descriptors. |
| ` boolean` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#executeReliableWrite()() ` Executes a reliable write transaction for a given remote device. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/bluetooth/BluetoothDevice>` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#getConnectedDevices()() ` *This method is deprecated. Not supported - please use `https://developer.android.com/reference/android/bluetooth/BluetoothManager#getConnectedDevices(int)` with `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#GATT` as argument* |
| ` int` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#getConnectionState(android.bluetooth.BluetoothDevice)(https://developer.android.com/reference/android/bluetooth/BluetoothDevice device) ` *This method is deprecated. Not supported - please use `https://developer.android.com/reference/android/bluetooth/BluetoothManager#getConnectedDevices(int)` with `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#GATT` as argument* |
| ` https://developer.android.com/reference/android/bluetooth/BluetoothDevice` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#getDevice()() ` Return the remote bluetooth device this GATT client targets to |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/bluetooth/BluetoothDevice>` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#getDevicesMatchingConnectionStates(int[])(int[] states) ` *This method is deprecated. Not supported - please use `https://developer.android.com/reference/android/bluetooth/BluetoothManager#getDevicesMatchingConnectionStates(int,%20int[])` with `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#GATT` as first argument* |
| ` https://developer.android.com/reference/android/bluetooth/BluetoothGattService` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#getService(java.util.UUID)(https://developer.android.com/reference/java/util/UUID uuid) ` Returns a `https://developer.android.com/reference/android/bluetooth/BluetoothGattService`, if the requested UUID is supported by the remote device. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/bluetooth/BluetoothGattService>` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#getServices()() ` Returns a list of GATT services offered by the remote device. |
| ` boolean` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#readCharacteristic(android.bluetooth.BluetoothGattCharacteristic)(https://developer.android.com/reference/android/bluetooth/BluetoothGattCharacteristic characteristic) ` Reads the requested characteristic from the associated remote device. |
| ` boolean` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#readDescriptor(android.bluetooth.BluetoothGattDescriptor)(https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor descriptor) ` Reads the value for a given descriptor from the associated remote device. |
| ` void` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#readPhy()() ` Read the current transmitter PHY and receiver PHY of the connection. |
| ` boolean` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#readRemoteRssi()() ` Read the RSSI for a connected remote device. |
| ` boolean` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#requestConnectionPriority(int)(int connectionPriority) ` Request a connection parameter update. |
| ` boolean` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#requestMtu(int)(int mtu) ` Request an MTU size used for a given connection. |
| ` int` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#requestSubrateMode(int)(int subrateMode) ` Request LE subrate mode. |
| ` boolean` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#setCharacteristicNotification(android.bluetooth.BluetoothGattCharacteristic,%20boolean)(https://developer.android.com/reference/android/bluetooth/BluetoothGattCharacteristic characteristic, boolean enable) ` Enable or disable notifications/indications for a given characteristic. |
| ` void` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#setPreferredPhy(int,%20int,%20int)(int txPhy, int rxPhy, int phyOptions) ` Set the preferred connection PHY for this app. |
| ` boolean` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic)(https://developer.android.com/reference/android/bluetooth/BluetoothGattCharacteristic characteristic) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic,%20byte[],%20int)` as this is not memory safe because it relies on a `https://developer.android.com/reference/android/bluetooth/BluetoothGattCharacteristic` object whose underlying fields are subject to change outside this method.* |
| ` int` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic,%20byte[],%20int)(https://developer.android.com/reference/android/bluetooth/BluetoothGattCharacteristic characteristic, byte[] value, int writeType) ` Writes a given characteristic and its values to the associated remote device. |
| ` boolean` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#writeDescriptor(android.bluetooth.BluetoothGattDescriptor)(https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor descriptor) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#writeDescriptor(android.bluetooth.BluetoothGattDescriptor,%20byte[])` as this is not memory safe because it relies on a `https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor` object whose underlying fields are subject to change outside this method.* |
| ` int` | ` https://developer.android.com/reference/android/bluetooth/BluetoothGatt#writeDescriptor(android.bluetooth.BluetoothGattDescriptor,%20byte[])(https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor descriptor, byte[] value) ` Write the value of a given descriptor to the associated remote device. |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


From interface `

https://developer.android.com/reference/android/bluetooth/BluetoothProfile

` `
abstract


https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/bluetooth/BluetoothDevice>` `
https://developer.android.com/reference/android/bluetooth/BluetoothProfile#getConnectedDevices()()
`

Get connected devices for this specific profile.


`
abstract


int` `
https://developer.android.com/reference/android/bluetooth/BluetoothProfile#getConnectionState(android.bluetooth.BluetoothDevice)(https://developer.android.com/reference/android/bluetooth/BluetoothDevice device)
`

Get the current connection state of the profile


`
abstract


https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/bluetooth/BluetoothDevice>` `
https://developer.android.com/reference/android/bluetooth/BluetoothProfile#getDevicesMatchingConnectionStates(int[])(int[] states)
`

Get a list of devices that match any of the given connection states.


## Constants

### CONNECTION_PRIORITY_BALANCED

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CONNECTION_PRIORITY_BALANCED
```

Connection parameter update - Use the connection parameters recommended by the Bluetooth SIG.
This is the default value if no connection parameter update is requested.

<br />

Constant Value:

0
(0x00000000)


### CONNECTION_PRIORITY_DCK

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CONNECTION_PRIORITY_DCK
```

Connection parameter update - Request the priority preferred for Digital Car Key for a lower
latency connection. This connection parameter will consume more power than `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_BALANCED`, so it is recommended that apps do not use this
unless it specifically fits their use case.

<br />

Constant Value:

3
(0x00000003)


### CONNECTION_PRIORITY_HIGH

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CONNECTION_PRIORITY_HIGH
```

Connection parameter update - Request a high priority, low latency connection. An application
should only request high priority connection parameters to transfer large amounts of data
over LE quickly. Once the transfer is complete, the application should request `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_BALANCED` connection parameters to reduce energy use.

<br />

Constant Value:

1
(0x00000001)


### CONNECTION_PRIORITY_LOW_POWER

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CONNECTION_PRIORITY_LOW_POWER
```

Connection parameter update - Request low power, reduced data rate connection parameters.

<br />

Constant Value:

2
(0x00000002)


### GATT_CONNECTION_CONGESTED

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GATT_CONNECTION_CONGESTED
```

A remote device connection is congested.

<br />

Constant Value:

143
(0x0000008f)


### GATT_CONNECTION_TIMEOUT

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GATT_CONNECTION_TIMEOUT
```

GATT connection timed out, likely due to the remote device being out of range or not
advertising as connectable.

<br />

Constant Value:

147
(0x00000093)


### GATT_FAILURE

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GATT_FAILURE
```

A GATT operation failed, errors other than the above

<br />

Constant Value:

257
(0x00000101)


### GATT_INSUFFICIENT_AUTHENTICATION

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GATT_INSUFFICIENT_AUTHENTICATION
```

Insufficient authentication for a given operation

<br />

Constant Value:

5
(0x00000005)


### GATT_INSUFFICIENT_AUTHORIZATION

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GATT_INSUFFICIENT_AUTHORIZATION
```

Insufficient authorization for a given operation

<br />

Constant Value:

8
(0x00000008)


### GATT_INSUFFICIENT_ENCRYPTION

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GATT_INSUFFICIENT_ENCRYPTION
```

Insufficient encryption for a given operation

<br />

Constant Value:

15
(0x0000000f)


### GATT_INVALID_ATTRIBUTE_LENGTH

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GATT_INVALID_ATTRIBUTE_LENGTH
```

A write operation exceeds the maximum length of the attribute

<br />

Constant Value:

13
(0x0000000d)


### GATT_INVALID_OFFSET

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GATT_INVALID_OFFSET
```

A read or write operation was requested with an invalid offset

<br />

Constant Value:

7
(0x00000007)


### GATT_READ_NOT_PERMITTED

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GATT_READ_NOT_PERMITTED
```

GATT read operation is not permitted

<br />

Constant Value:

2
(0x00000002)


### GATT_REQUEST_NOT_SUPPORTED

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GATT_REQUEST_NOT_SUPPORTED
```

The given request is not supported

<br />

Constant Value:

6
(0x00000006)


### GATT_SUCCESS

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GATT_SUCCESS
```

A GATT operation completed successfully

<br />

Constant Value:

0
(0x00000000)


### GATT_WRITE_NOT_PERMITTED

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GATT_WRITE_NOT_PERMITTED
```

GATT write operation is not permitted

<br />

Constant Value:

3
(0x00000003)


### SUBRATE_MODE_BALANCED

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int SUBRATE_MODE_BALANCED
```

Connection subrate mode - Requests to enable subrate mode using balanced parameters to
provide a compromise between power savings and performance.

<br />

Constant Value:

2
(0x00000002)


### SUBRATE_MODE_HIGH

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int SUBRATE_MODE_HIGH
```

Connection subrate mode - Requests to enable subrate mode with parameters optimized for high
burstiness, enhanced data transfer.

<br />

Constant Value:

3
(0x00000003)


### SUBRATE_MODE_LOW

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int SUBRATE_MODE_LOW
```

Connection Subrate mode - Requests to enable subrate mode with parameters optimized for low
burstiness, minimum power consumption. This is the most power-efficient subrate
configuration.

<br />

Constant Value:

1
(0x00000001)


### SUBRATE_MODE_NOT_UPDATED

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int SUBRATE_MODE_NOT_UPDATED
```

Connection Subrate mode - No Update applied due to error.

<br />

Constant Value:

255
(0x000000ff)


### SUBRATE_MODE_OFF

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int SUBRATE_MODE_OFF
```

Connection Subrate mode - Request to disable subrate mode.

<br />

Constant Value:

0
(0x00000000)


### SUBRATE_MODE_SYSTEM_UPDATE

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int SUBRATE_MODE_SYSTEM_UPDATE
```

Connection Subrate mode - System Update.

<br />

Constant Value:

99
(0x00000063)


## Public methods

### abortReliableWrite

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void abortReliableWrite (BluetoothDevice mDevice)
```


**This method was deprecated
in API level 19.**   

Use `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#abortReliableWrite()`

For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Parameters ||
|---|---|
| `mDevice` | `BluetoothDevice` <br /> |

### abortReliableWrite

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void abortReliableWrite ()
```

Cancels a reliable write transaction for a given device.

Calling this function will discard all queued characteristic write operations for a given
remote device.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R` or lower, this requires the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH` permission which can be gained with a simple `<uses-permission>` manifest tag.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

### beginReliableWrite

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean beginReliableWrite ()
```

Initiates a reliable write transaction for a given remote device.

Once a reliable write transaction has been initiated, all calls to `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic)` are sent to the remote device for verification and queued up for atomic
execution. The application will receive a `https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onCharacteristicWrite(android.bluetooth.BluetoothGatt,%20android.bluetooth.BluetoothGattCharacteristic,%20int)`
callback in response to every `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic,%20byte[],%20int)` call and is responsible for verifying if the value has been transmitted
accurately.

After all characteristics have been queued up and verified, `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#executeReliableWrite()`
will execute all writes. If a characteristic was not written correctly, calling `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#abortReliableWrite()` will cancel the current transaction without committing any values on the
remote device.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R` or lower, this requires the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH` permission which can be gained with a simple `<uses-permission>` manifest tag.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Returns ||
|---|---|
| `boolean` | true, if the reliable write transaction has been initiated <br /> |

### close

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void close ()
```

Close this Bluetooth GATT client.

Application should call this method as early as possible after it is done with this GATT
client.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

### connect

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean connect ()
```

Connect back to remote device.

This method is used to re-connect to a remote device after the connection has been
dropped. If the device is not in range, the re-connection will be triggered once the device
is back in range.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Returns ||
|---|---|
| `boolean` | true, if the connection attempt was initiated successfully <br /> |

### disconnect

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void disconnect ()
```

Disconnects an established connection, or cancels a connection attempt currently in progress.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R` or lower, this requires the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH` permission which can be gained with a simple `<uses-permission>` manifest tag.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

### discoverServices

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean discoverServices ()
```

Discovers services offered by a remote device as well as their characteristics and
descriptors.

This is an asynchronous operation. Once service discovery is completed, the `https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onServicesDiscovered(android.bluetooth.BluetoothGatt,%20int)` callback is triggered. If the discovery was
successful, the remote services can be retrieved using the `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#getServices()` function.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R` or lower, this requires the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH` permission which can be gained with a simple `<uses-permission>` manifest tag.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Returns ||
|---|---|
| `boolean` | true, if the remote service discovery has been started <br /> |

### executeReliableWrite

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean executeReliableWrite ()
```

Executes a reliable write transaction for a given remote device.

This function will commit all queued up characteristic write operations for a given remote
device.

A `https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onReliableWriteCompleted(android.bluetooth.BluetoothGatt,%20int)` callback is invoked to indicate
whether the transaction has been executed correctly.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R` or lower, this requires the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH` permission which can be gained with a simple `<uses-permission>` manifest tag.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Returns ||
|---|---|
| `boolean` | true, if the request to execute the transaction has been sent <br /> |

### getConnectedDevices

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<BluetoothDevice> getConnectedDevices ()
```


**This method is deprecated.**   

Not supported - please use `https://developer.android.com/reference/android/bluetooth/BluetoothManager#getConnectedDevices(int)` with
`https://developer.android.com/reference/android/bluetooth/BluetoothProfile#GATT` as argument

Get connected devices for this specific profile.

Return the set of devices which are in state `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_CONNECTED`

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/bluetooth/BluetoothDevice>` | List of devices. The list will be empty on error. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | on every call |

### getConnectionState

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getConnectionState (BluetoothDevice device)
```


**This method is deprecated.**   

Not supported - please use `https://developer.android.com/reference/android/bluetooth/BluetoothManager#getConnectedDevices(int)` with
`https://developer.android.com/reference/android/bluetooth/BluetoothProfile#GATT` as argument

Get the current connection state of the profile

<br />

| Parameters ||
|---|---|
| `device` | `BluetoothDevice`: Remote bluetooth device. <br /> |

| Returns ||
|---|---|
| `int` | State of the profile connection. One of `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_CONNECTED`, `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_CONNECTING`, `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_DISCONNECTED`, `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_DISCONNECTING` Value is one of the following: - `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_DISCONNECTED` - `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_CONNECTING` - `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_CONNECTED` - `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_DISCONNECTING` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | on every call |

### getDevice

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public BluetoothDevice getDevice ()
```

Return the remote bluetooth device this GATT client targets to

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/bluetooth/BluetoothDevice` | remote bluetooth device <br /> |

### getDevicesMatchingConnectionStates

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<BluetoothDevice> getDevicesMatchingConnectionStates (int[] states)
```


**This method is deprecated.**   

Not supported - please use `https://developer.android.com/reference/android/bluetooth/BluetoothManager#getDevicesMatchingConnectionStates(int,%20int[])` with `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#GATT` as first argument

Get a list of devices that match any of the given connection states.

If none of the devices match any of the given states, an empty list will be returned.

<br />

| Parameters ||
|---|---|
| `states` | `int`: Array of states. States can be one of `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_CONNECTED`, `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_CONNECTING`, `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_DISCONNECTED`, `https://developer.android.com/reference/android/bluetooth/BluetoothProfile#STATE_DISCONNECTING`, <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/bluetooth/BluetoothDevice>` | List of devices. The list will be empty on error. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | on every call |

### getService

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public BluetoothGattService getService (UUID uuid)
```

Returns a `https://developer.android.com/reference/android/bluetooth/BluetoothGattService`, if the requested UUID is supported by the remote
device.

This function requires that service discovery has been completed for the given device.

If multiple instances of the same service (as identified by UUID) exist, the first
instance of the service is returned.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R` or lower, this requires the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH` permission which can be gained with a simple `<uses-permission>` manifest tag.

<br />

| Parameters ||
|---|---|
| `uuid` | `UUID`: UUID of the requested service <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/bluetooth/BluetoothGattService` | BluetoothGattService if supported, or null if the requested service is not offered by the remote device. <br /> |

### getServices

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<BluetoothGattService> getServices ()
```

Returns a list of GATT services offered by the remote device.

This function requires that service discovery has been completed for the given device.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R` or lower, this requires the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH` permission which can be gained with a simple `<uses-permission>` manifest tag.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/bluetooth/BluetoothGattService>` | List of services on the remote device. Returns an empty list if service discovery has not yet been performed. <br /> |

### readCharacteristic

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean readCharacteristic (BluetoothGattCharacteristic characteristic)
```

Reads the requested characteristic from the associated remote device.

This is an asynchronous operation. The result of the read operation is reported by the
`https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onCharacteristicRead(android.bluetooth.BluetoothGatt,%20android.bluetooth.BluetoothGattCharacteristic,%20byte[],%20int)` callback.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R` or lower, this requires the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH` permission which can be gained with a simple `<uses-permission>` manifest tag.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Parameters ||
|---|---|
| `characteristic` | `BluetoothGattCharacteristic`: Characteristic to read from the remote device <br /> |

| Returns ||
|---|---|
| `boolean` | true, if the read operation was initiated successfully <br /> |

### readDescriptor

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean readDescriptor (BluetoothGattDescriptor descriptor)
```

Reads the value for a given descriptor from the associated remote device.

Once the read operation has been completed, the `https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onDescriptorRead(android.bluetooth.BluetoothGatt,%20android.bluetooth.BluetoothGattDescriptor,%20int)` callback is triggered, signaling the result of the
operation.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R` or lower, this requires the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH` permission which can be gained with a simple `<uses-permission>` manifest tag.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Parameters ||
|---|---|
| `descriptor` | `BluetoothGattDescriptor`: Descriptor value to read from the remote device <br /> |

| Returns ||
|---|---|
| `boolean` | true, if the read operation was initiated successfully <br /> |

### readPhy

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void readPhy ()
```

Read the current transmitter PHY and receiver PHY of the connection. The values are returned
in `https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onPhyRead(android.bluetooth.BluetoothGatt,%20int,%20int,%20int)`


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

### readRemoteRssi

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean readRemoteRssi ()
```

Read the RSSI for a connected remote device.

The `https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onReadRemoteRssi(android.bluetooth.BluetoothGatt,%20int,%20int)` callback will be invoked when the RSSI
value has been read.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R` or lower, this requires the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH` permission which can be gained with a simple `<uses-permission>` manifest tag.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Returns ||
|---|---|
| `boolean` | true, if the RSSI value has been requested successfully <br /> |

### requestConnectionPriority

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean requestConnectionPriority (int connectionPriority)
```

Request a connection parameter update.

This function will send a connection parameter update request to the remote device.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Parameters ||
|---|---|
| `connectionPriority` | `int`: Request a specific connection priority. Value is one of the following: - `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_BALANCED` - `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_HIGH` - `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_LOW_POWER` - `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#CONNECTION_PRIORITY_DCK` |

| Returns ||
|---|---|
| `boolean` | <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the parameters are outside of their specified range. |

### requestMtu

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean requestMtu (int mtu)
```

Request an MTU size used for a given connection. Please note that starting from Android 14,
the Android Bluetooth stack requests the BLE ATT MTU to 517 bytes when the first GATT client
requests an MTU, and disregards all subsequent MTU requests. Check out [MTU is set to 517 for
the first GATT client requesting an MTU](https://developer.android.com/about/versions/14/behavior-changes-all#mtu-set-to-517) for more information.

When performing a write request operation (write without response), the data sent is
truncated to the MTU size. This function may be used to request a larger MTU size to be able
to send more data at once.

A `https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onMtuChanged(android.bluetooth.BluetoothGatt,%20int,%20int)` callback will indicate whether this operation
was successful.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R` or lower, this requires the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH` permission which can be gained with a simple `<uses-permission>` manifest tag.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Parameters ||
|---|---|
| `mtu` | `int` <br /> |

| Returns ||
|---|---|
| `boolean` | true, if the new MTU value has been requested successfully <br /> |

### requestSubrateMode

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public int requestSubrateMode (int subrateMode)
```

Request LE subrate mode.

Configure/Request subrating with this API, sending a subrate request to the remote device
based on Subrate Mode. This function should be used in conjunction with `https://developer.android.com/` to manage link latency and power consumption effectively.

This method requires the calling app to have the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission. Additionally, an app must either
have the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_PRIVILEGED` or be associated with the
Companion Device manager (see `https://developer.android.com/reference/android/companion/CompanionDeviceManager#associate(android.companion.AssociationRequest,%20android.companion.CompanionDeviceManager.Callback,%20android.os.Handler)`).


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.

<br />

| Parameters ||
|---|---|
| `subrateMode` | `int`: Request a specific subrate mode. Value is one of the following: - `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#SUBRATE_MODE_OFF` - `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#SUBRATE_MODE_LOW` - `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#SUBRATE_MODE_BALANCED` - `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#SUBRATE_MODE_HIGH` |

| Returns ||
|---|---|
| `int` | true, if the request is send to the Bluetooth stack. Value is one of the following: - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#SUCCESS` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_BLUETOOTH_NOT_ENABLED` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_BLUETOOTH_NOT_ALLOWED` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_MISSING_BLUETOOTH_CONNECT_PERMISSION` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_DEVICE_NOT_BONDED` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#FEATURE_NOT_SUPPORTED` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_UNKNOWN` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the parameters are outside of their specified range. |

### setCharacteristicNotification

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean setCharacteristicNotification (BluetoothGattCharacteristic characteristic, 
                boolean enable)
```

Enable or disable notifications/indications for a given characteristic.

Once notifications are enabled for a characteristic, a `https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onCharacteristicChanged(android.bluetooth.BluetoothGatt,%20android.bluetooth.BluetoothGattCharacteristic,%20byte[])` callback will be triggered if the remote device indicates that the given
characteristic has changed.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R` or lower, this requires the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH` permission which can be gained with a simple `<uses-permission>` manifest tag.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Parameters ||
|---|---|
| `characteristic` | `BluetoothGattCharacteristic`: The characteristic for which to enable notifications <br /> |
| `enable` | `boolean`: Set to true to enable notifications/indications <br /> |

| Returns ||
|---|---|
| `boolean` | true, if the requested notification status was set successfully <br /> |

### setPreferredPhy

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setPreferredPhy (int txPhy, 
                int rxPhy, 
                int phyOptions)
```

Set the preferred connection PHY for this app. Please note that this is just a
recommendation, whether the PHY change will happen depends on other applications preferences,
local and remote controller capabilities. Controller can override these settings.

`https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onPhyUpdate(android.bluetooth.BluetoothGatt,%20int,%20int,%20int)` will be triggered as a result of this call, even
if no PHY change happens. It is also triggered when remote device updates the PHY.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Parameters ||
|---|---|
| `txPhy` | `int`: preferred transmitter PHY. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/bluetooth/BluetoothDevice#PHY_LE_1M_MASK` - `https://developer.android.com/reference/android/bluetooth/BluetoothDevice#PHY_LE_2M_MASK` - `https://developer.android.com/reference/android/bluetooth/BluetoothDevice#PHY_LE_CODED_MASK` - `https://developer.android.com/reference/android/bluetooth/BluetoothDevice#PHY_LE_HDT_MASK` |
| `rxPhy` | `int`: preferred receiver PHY. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/bluetooth/BluetoothDevice#PHY_LE_1M_MASK` - `https://developer.android.com/reference/android/bluetooth/BluetoothDevice#PHY_LE_2M_MASK` - `https://developer.android.com/reference/android/bluetooth/BluetoothDevice#PHY_LE_CODED_MASK` - `https://developer.android.com/reference/android/bluetooth/BluetoothDevice#PHY_LE_HDT_MASK` |
| `phyOptions` | `int`: preferred coding to use when transmitting on the LE Coded PHY. Can be one of `https://developer.android.com/reference/android/bluetooth/BluetoothDevice#PHY_OPTION_NO_PREFERRED`, `https://developer.android.com/reference/android/bluetooth/BluetoothDevice#PHY_OPTION_S2` or `https://developer.android.com/reference/android/bluetooth/BluetoothDevice#PHY_OPTION_S8`. <br /> |

### writeCharacteristic

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean writeCharacteristic (BluetoothGattCharacteristic characteristic)
```


**This method was deprecated
in API level 33.**   

Use `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic,%20byte[],%20int)` as this is not memory safe because it relies on a `https://developer.android.com/reference/android/bluetooth/BluetoothGattCharacteristic` object whose underlying fields are subject to change outside
this method.

Writes a given characteristic and its values to the associated remote device.

Once the write operation has been completed, the `https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onCharacteristicWrite(android.bluetooth.BluetoothGatt,%20android.bluetooth.BluetoothGattCharacteristic,%20int)` callback is invoked, reporting the result of the
operation.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R` or lower, this requires the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH` permission which can be gained with a simple `<uses-permission>` manifest tag.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Parameters ||
|---|---|
| `characteristic` | `BluetoothGattCharacteristic`: Characteristic to write on the remote device <br /> |

| Returns ||
|---|---|
| `boolean` | true, if the write operation was initiated successfully <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if characteristic or its value are null |

### writeCharacteristic

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int writeCharacteristic (BluetoothGattCharacteristic characteristic, 
                byte[] value, 
                int writeType)
```

Writes a given characteristic and its values to the associated remote device.

Once the write operation has been completed, the `https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onCharacteristicWrite(android.bluetooth.BluetoothGatt,%20android.bluetooth.BluetoothGattCharacteristic,%20int)` callback is invoked, reporting the result of the
operation.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Parameters ||
|---|---|
| `characteristic` | `BluetoothGattCharacteristic`: Characteristic to write on the remote device. This value cannot be `null`. <br /> |
| `value` | `byte`: This value cannot be `null`. <br /> |
| `writeType` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/bluetooth/BluetoothGattCharacteristic#WRITE_TYPE_DEFAULT` - `https://developer.android.com/reference/android/bluetooth/BluetoothGattCharacteristic#WRITE_TYPE_NO_RESPONSE` - `https://developer.android.com/reference/android/bluetooth/BluetoothGattCharacteristic#WRITE_TYPE_SIGNED` |

| Returns ||
|---|---|
| `int` | whether the characteristic was successfully written to. Value is one of the following: - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#SUCCESS` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_MISSING_BLUETOOTH_CONNECT_PERMISSION` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_PROFILE_SERVICE_NOT_BOUND` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_GATT_WRITE_NOT_ALLOWED` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_GATT_WRITE_REQUEST_BUSY` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_UNKNOWN` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if characteristic or value are null |

### writeDescriptor

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean writeDescriptor (BluetoothGattDescriptor descriptor)
```


**This method was deprecated
in API level 33.**   

Use `https://developer.android.com/reference/android/bluetooth/BluetoothGatt#writeDescriptor(android.bluetooth.BluetoothGattDescriptor,%20byte[])` as
this is not memory safe because it relies on a `https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor` object
whose underlying fields are subject to change outside this method.

Write the value of a given descriptor to the associated remote device.

A `https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onDescriptorWrite(android.bluetooth.BluetoothGatt,%20android.bluetooth.BluetoothGattDescriptor,%20int)` callback is triggered to report the
result of the write operation.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R` or lower, this requires the `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH` permission which can be gained with a simple `<uses-permission>` manifest tag.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Parameters ||
|---|---|
| `descriptor` | `BluetoothGattDescriptor`: Descriptor to write to the associated remote device <br /> |

| Returns ||
|---|---|
| `boolean` | true, if the write operation was initiated successfully <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if descriptor or its value are null |

### writeDescriptor

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int writeDescriptor (BluetoothGattDescriptor descriptor, 
                byte[] value)
```

Write the value of a given descriptor to the associated remote device.

A `https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onDescriptorWrite(android.bluetooth.BluetoothGatt,%20android.bluetooth.BluetoothGattDescriptor,%20int)` callback is triggered to report the
result of the write operation.


For apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` or or higher, this requires the
`https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT` permission which can be gained with `https://developer.android.com/reference/android/app/Activity#requestPermissions(java.lang.String[],%20int)`.


Requires `https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT`

<br />

| Parameters ||
|---|---|
| `descriptor` | `BluetoothGattDescriptor`: Descriptor to write to the associated remote device. This value cannot be `null`. <br /> |
| `value` | `byte`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `int` | true, if the write operation was initiated successfully. Value is one of the following: - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#SUCCESS` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_MISSING_BLUETOOTH_CONNECT_PERMISSION` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_PROFILE_SERVICE_NOT_BOUND` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_GATT_WRITE_NOT_ALLOWED` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_GATT_WRITE_REQUEST_BUSY` - `https://developer.android.com/reference/android/bluetooth/BluetoothStatusCodes#ERROR_UNKNOWN` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if descriptor or value are null |