# BluetoothGattDescriptor

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/BluetoothGattDescriptor#constants) \| [Inherited Constants](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#inhconstants) \| [Fields](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#lfields) \| [Ctors](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#pubctors) \| [Methods](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#inhmethods)  

# BluetoothGattDescriptor

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothGattDescriptor "View this page in Kotlin") \|Java


`
public


class
BluetoothGattDescriptor
`


`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


`

`


implements

`[Parcelable](https://developer.android.com/reference/android/os/Parcelable)`


`

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

<br />

*** ** * ** ***

Represents a Bluetooth GATT Descriptor

GATT Descriptors contain additional information and attributes of a GATT characteristic,
[BluetoothGattCharacteristic](https://developer.android.com/reference/android/bluetooth/BluetoothGattCharacteristic). They can be used to describe the characteristic's features
or to control certain behaviours of the characteristic.

## Summary

|                                                                                                                  ### Constants                                                                                                                  ||
|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [PERMISSION_READ](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#PERMISSION_READ) Descriptor read permission                                                                                          |
| `int` | [PERMISSION_READ_ENCRYPTED](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#PERMISSION_READ_ENCRYPTED) Descriptor permission: Allow encrypted read operations                                          |
| `int` | [PERMISSION_READ_ENCRYPTED_MITM](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#PERMISSION_READ_ENCRYPTED_MITM) Descriptor permission: Allow reading with person-in-the-middle protection             |
| `int` | [PERMISSION_WRITE](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#PERMISSION_WRITE) Descriptor write permission                                                                                       |
| `int` | [PERMISSION_WRITE_ENCRYPTED](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#PERMISSION_WRITE_ENCRYPTED) Descriptor permission: Allow encrypted writes                                                 |
| `int` | [PERMISSION_WRITE_ENCRYPTED_MITM](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#PERMISSION_WRITE_ENCRYPTED_MITM) Descriptor permission: Allow encrypted writes with person-in-the-middle protection  |
| `int` | [PERMISSION_WRITE_SIGNED](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#PERMISSION_WRITE_SIGNED) Descriptor permission: Allow signed write operations                                                |
| `int` | [PERMISSION_WRITE_SIGNED_MITM](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#PERMISSION_WRITE_SIGNED_MITM) Descriptor permission: Allow signed write operations with person-in-the-middle protection |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From interface [android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable) |-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `int` | [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR) Descriptor bit used with [describeContents()](https://developer.android.com/reference/android/os/Parcelable#describeContents()): indicates that the Parcelable object's flattened representation includes a file descriptor.                                                                                                                                            | | `int` | [PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE) Flag for use with [writeToParcel(Parcel, int)](https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)): the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". | |

|                                                                                                                                                                                                                 ### Fields                                                                                                                                                                                                                  ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` public static final `[Creator](https://developer.android.com/reference/android/os/Parcelable.Creator)`<`[BluetoothGattDescriptor](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor)`>` | [CREATOR](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#CREATOR)                                                                                                             |
| ` public static final byte[]`                                                                                                                                                                                             | [DISABLE_NOTIFICATION_VALUE](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#DISABLE_NOTIFICATION_VALUE) Value used to disable notifications or indications                    |
| ` public static final byte[]`                                                                                                                                                                                             | [ENABLE_INDICATION_VALUE](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#ENABLE_INDICATION_VALUE) Value used to enable indication for a client configuration descriptor       |
| ` public static final byte[]`                                                                                                                                                                                             | [ENABLE_NOTIFICATION_VALUE](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#ENABLE_NOTIFICATION_VALUE) Value used to enable notification for a client configuration descriptor |

|                                                                                                                                      ### Public constructors                                                                                                                                       ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[BluetoothGattDescriptor](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#BluetoothGattDescriptor(java.util.UUID,%20int))`(`[UUID](https://developer.android.com/reference/java/util/UUID)` uuid, int permissions) ` Create a new BluetoothGattDescriptor. |

|                                                                                                                                                                                                                                                                                 ### Public methods                                                                                                                                                                                                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int`                                                                                                                  | ` `[describeContents](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#describeContents())`() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.                                                                                                                                                                                                                  |
| ` `[BluetoothGattCharacteristic](https://developer.android.com/reference/android/bluetooth/BluetoothGattCharacteristic) | ` `[getCharacteristic](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#getCharacteristic())`() ` Returns the characteristic this descriptor belongs to.                                                                                                                                                                                                                                                                 |
| ` int`                                                                                                                  | ` `[getPermissions](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#getPermissions())`() ` Returns the permissions for this descriptor.                                                                                                                                                                                                                                                                                 |
| ` `[UUID](https://developer.android.com/reference/java/util/UUID)                                                       | ` `[getUuid](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#getUuid())`() ` Returns the UUID of this descriptor.                                                                                                                                                                                                                                                                                                       |
| ` byte[]`                                                                                                               | ` `[getValue](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#getValue())`() ` *This method was deprecated in API level 33. Use [BluetoothGatt.readDescriptor(BluetoothGattDescriptor)](https://developer.android.com/reference/android/bluetooth/BluetoothGatt#readDescriptor(android.bluetooth.BluetoothGattDescriptor)) instead*                                                                                     |
| ` boolean`                                                                                                              | ` `[setValue](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#setValue(byte[]))`(byte[] value) ` *This method was deprecated in API level 33. Pass the descriptor value directly into [BluetoothGatt.writeDescriptor(android.bluetooth.BluetoothGattDescriptor, byte[])](https://developer.android.com/reference/android/bluetooth/BluetoothGatt#writeDescriptor(android.bluetooth.BluetoothGattDescriptor,%20byte[]))* |
| ` void`                                                                                                                 | ` `[writeToParcel](https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor#writeToParcel(android.os.Parcel,%20int))`(`[Parcel](https://developer.android.com/reference/android/os/Parcel)` out, int flags) ` Flatten this object in to a Parcel.                                                                                                                                                                                |

| ### Inherited methods |
|-----------------------|---|
| From class ` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                        | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                             | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this `Object`.                                                                                                                                                 | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                   | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                              | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                           | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                              | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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 ` `[android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable)` ` |------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract int`  | ` `[describeContents](https://developer.android.com/reference/android/os/Parcelable#describeContents())`() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.                                    | | ` abstract void` | ` `[writeToParcel](https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int))`(`[Parcel](https://developer.android.com/reference/android/os/Parcel)` dest, int flags) ` Flatten this object in to a Parcel. | ||

## Constants

### PERMISSION_READ

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

```
public static final int PERMISSION_READ
```

Descriptor read permission

<br />

Constant Value:

1
(0x00000001)


### PERMISSION_READ_ENCRYPTED

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

```
public static final int PERMISSION_READ_ENCRYPTED
```

Descriptor permission: Allow encrypted read operations

<br />

Constant Value:

2
(0x00000002)


### PERMISSION_READ_ENCRYPTED_MITM

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

```
public static final int PERMISSION_READ_ENCRYPTED_MITM
```

Descriptor permission: Allow reading with person-in-the-middle protection

<br />

Constant Value:

4
(0x00000004)


### PERMISSION_WRITE

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

```
public static final int PERMISSION_WRITE
```

Descriptor write permission

<br />

Constant Value:

16
(0x00000010)


### PERMISSION_WRITE_ENCRYPTED

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

```
public static final int PERMISSION_WRITE_ENCRYPTED
```

Descriptor permission: Allow encrypted writes

<br />

Constant Value:

32
(0x00000020)


### PERMISSION_WRITE_ENCRYPTED_MITM

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

```
public static final int PERMISSION_WRITE_ENCRYPTED_MITM
```

Descriptor permission: Allow encrypted writes with person-in-the-middle protection

<br />

Constant Value:

64
(0x00000040)


### PERMISSION_WRITE_SIGNED

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

```
public static final int PERMISSION_WRITE_SIGNED
```

Descriptor permission: Allow signed write operations

<br />

Constant Value:

128
(0x00000080)


### PERMISSION_WRITE_SIGNED_MITM

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

```
public static final int PERMISSION_WRITE_SIGNED_MITM
```

Descriptor permission: Allow signed write operations with person-in-the-middle protection

<br />

Constant Value:

256
(0x00000100)


## Fields

### CREATOR

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

```
public static final Creator<BluetoothGattDescriptor> CREATOR
```

<br />

<br />

### DISABLE_NOTIFICATION_VALUE

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

```
public static final byte[] DISABLE_NOTIFICATION_VALUE
```

Value used to disable notifications or indications

<br />

### ENABLE_INDICATION_VALUE

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

```
public static final byte[] ENABLE_INDICATION_VALUE
```

Value used to enable indication for a client configuration descriptor

<br />

### ENABLE_NOTIFICATION_VALUE

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

```
public static final byte[] ENABLE_NOTIFICATION_VALUE
```

Value used to enable notification for a client configuration descriptor

<br />

## Public constructors

### BluetoothGattDescriptor

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

```
public BluetoothGattDescriptor (UUID uuid, 
                int permissions)
```

Create a new BluetoothGattDescriptor.

<br />

|                          Parameters                          ||
|---------------|-----------------------------------------------|
| `uuid`        | `UUID`: The UUID for this descriptor <br />   |
| `permissions` | `int`: Permissions for this descriptor <br /> |

## Public methods

### describeContents

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

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of [writeToParcel(android.os.Parcel, int)](https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)),
the return value of this method must include the
[CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR) bit.

<br />

|                                                                                                                          Returns                                                                                                                           ||
|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR) <br /> |

### getCharacteristic

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

```
public BluetoothGattCharacteristic getCharacteristic ()
```

Returns the characteristic this descriptor belongs to.

<br />

|                                                                     Returns                                                                      ||
|----------------------------------------------------------------------------------------------------------------------|----------------------------|
| [BluetoothGattCharacteristic](https://developer.android.com/reference/android/bluetooth/BluetoothGattCharacteristic) | The characteristic. <br /> |

### getPermissions

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

```
public int getPermissions ()
```

Returns the permissions for this descriptor.

<br />

|                   Returns                    ||
|-------|---------------------------------------|
| `int` | Permissions of this descriptor <br /> |

### getUuid

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

```
public UUID getUuid ()
```

Returns the UUID of this descriptor.

<br />

|                                            Returns                                             ||
|----------------------------------------------------------------|--------------------------------|
| [UUID](https://developer.android.com/reference/java/util/UUID) | UUID of this descriptor <br /> |

### getValue

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 byte[] getValue ()
```


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

Use [BluetoothGatt.readDescriptor(BluetoothGattDescriptor)](https://developer.android.com/reference/android/bluetooth/BluetoothGatt#readDescriptor(android.bluetooth.BluetoothGattDescriptor)) instead

Returns the stored value for this descriptor

This function returns the stored value for this descriptor as retrieved by calling [BluetoothGatt.readDescriptor(BluetoothGattDescriptor)](https://developer.android.com/reference/android/bluetooth/BluetoothGatt#readDescriptor(android.bluetooth.BluetoothGattDescriptor)). The cached value of the descriptor is updated as a result of a
descriptor read operation.

<br />

|                     Returns                     ||
|----------|---------------------------------------|
| `byte[]` | Cached value of the descriptor <br /> |

### setValue

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 setValue (byte[] value)
```


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

Pass the descriptor value directly into [BluetoothGatt.writeDescriptor(android.bluetooth.BluetoothGattDescriptor, byte[])](https://developer.android.com/reference/android/bluetooth/BluetoothGatt#writeDescriptor(android.bluetooth.BluetoothGattDescriptor,%20byte[]))

Updates the locally stored value of this descriptor.

This function modifies the locally stored cached value of this descriptor. To send the
value to the remote device, call [BluetoothGatt.writeDescriptor](https://developer.android.com/reference/android/bluetooth/BluetoothGatt#writeDescriptor(android.bluetooth.BluetoothGattDescriptor)) to send the value to
the remote device.

<br />

|                      Parameters                       ||
|---------|----------------------------------------------|
| `value` | `byte`: New value for this descriptor <br /> |

|                                                          Returns                                                           ||
|-----------|-----------------------------------------------------------------------------------------------------------------|
| `boolean` | true if the locally stored value has been set, false if the requested value could not be stored locally. <br /> |

### writeToParcel

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

```
public void writeToParcel (Parcel out, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

|                                                                                                                                                                                                                                 Parameters                                                                                                                                                                                                                                  ||
|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `out`   | `Parcel`: The Parcel in which the object should be written. This value cannot be `null`. <br />                                                                                                                                                                                                                                                                                                                                                                    |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or [Parcelable.PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE). Value is either `0` or a combination of [Parcelable.PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE), and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES <br /> |