# CredentialDescription

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

# CredentialDescription

*** ** * ** ***

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

```
class CredentialDescription : Parcelable
```

|---|----------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                         ||
| ↳ | [android.credentials.CredentialDescription](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#) |

Represents the type and contained data fields of a[Credential](https://developer.android.com/reference/kotlin/android/credentials/Credential).

## Summary

| Inherited constants ||
|---|---|
| From class[Parcelable](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#) |----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) <br /> Descriptor bit used with[describeContents()](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#describeContents()): indicates that the Parcelable object's flattened representation includes a file descriptor. <br />                                                                                                                                                                                                        | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int) <br /> Flag for use with[writeToParcel](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)): 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)`". Some implementations may want to release resources at this point. <br /> | ||

|                                                                                                                                                                                                                                                                                                                                                                                                                                                         Public constructors                                                                                                                                                                                                                                                                                                                                                                                                                                                          ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [CredentialDescription](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#CredentialDescription(kotlin.String,%20kotlin.collections.MutableSet,%20kotlin.collections.MutableList))`(`type:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `supportedElementKeys:` `[MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!>`, `credentialEntries:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[CredentialEntry](https://developer.android.com/reference/kotlin/android/service/credentials/CredentialEntry.html#)!>`)` Constructs a[CredentialDescription](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#). |

|                                                                                                                                                                                                                                                                                                                                                                  Public methods                                                                                                                                                                                                                                                                                                                                                                  ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                                                                      | [describeContents](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#describeContents())`()` <br />                                                                                                                                                                                                                                                                                                                                                                      |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                                              | [equals](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#equals(kotlin.Any))`(`other:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` [getType()](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#getType())and[getSupportedElementKeys()](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#getSupportedElementKeys())are enough for equality check. |
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[CredentialEntry](https://developer.android.com/reference/kotlin/android/service/credentials/CredentialEntry.html#)!\> | [getCredentialEntries](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#getCredentialEntries())`()` Returns the credential entries to be used in the UI.                                                                                                                                                                                                                                                                                                                |
| [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>                                      | [getSupportedElementKeys](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#getSupportedElementKeys())`()` Returns the flattened JSON string that will be matched with requests.                                                                                                                                                                                                                                                                                         |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)                                                                                                                                                | [getType](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#getType())`()` Returns the type of the Credential described.                                                                                                                                                                                                                                                                                                                                                 |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                                                                      | [hashCode](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#hashCode())`()` [getType()](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#getType())and[getSupportedElementKeys()](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#getSupportedElementKeys())are enough for hashing.                                                                                                    |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                    | [writeToParcel](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#writeToParcel(android.os.Parcel,%20kotlin.Int))`(`dest:` `[Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#)`, `flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Flatten this object in to a Parcel.                                                                                                                               |

|                                                                                                                                                                                       Properties                                                                                                                                                                                        ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Parcelable.Creator](https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator.html#)\<[CredentialDescription](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#)!\> | [CREATOR](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#CREATOR:android.os.Parcelable.Creator) <br /> |

## Public constructors

### CredentialDescription

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

```
CredentialDescription(
    type: String, 
    supportedElementKeys: MutableSet<String!>, 
    credentialEntries: MutableList<CredentialEntry!>)
```

Constructs a[CredentialDescription](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#).

|                                                                                                                                                                                                                                                                                                                                                                              Parameters                                                                                                                                                                                                                                                                                                                                                                              ||
|------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type`                 | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the type of the credential returned. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `supportedElementKeys` | [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>:Keys of elements to match with Credential requests. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `credentialEntries`    | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[CredentialEntry](https://developer.android.com/reference/kotlin/android/service/credentials/CredentialEntry.html#)!\>:a list of[CredentialEntry](https://developer.android.com/reference/kotlin/android/service/credentials/CredentialEntry.html#)s that are to be shown on the account selector if a credential matches with this description. Each entry contains information to be displayed within an entry on the UI, as well as a[android.app.PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent.html#)that will be invoked if the user selects this entry. This value cannot be`null`. |

|                       Exceptions                        ||
|--------------------------------------|-------------------|
| `java.lang.IllegalArgumentException` | If type is empty. |

## Public methods

### describeContents

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

```
fun describeContents(): Int
```

|                                                                                                                                                                               Return                                                                                                                                                                               ||
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either`0`or[android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) |

### equals

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

```
fun equals(other: Any?): Boolean
```

[getType()](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#getType())and[getSupportedElementKeys()](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#getSupportedElementKeys())are enough for equality check.

|                     Parameters                     ||
|-------|---------------------------------------------|
| `obj` | the reference object with which to compare. |

|                                                                           Return                                                                           ||
|------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`if this object is the same as the obj argument;`false`otherwise. |

### getCredentialEntries

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

```
fun getCredentialEntries(): MutableList<CredentialEntry!>
```

Returns the credential entries to be used in the UI.

|                                                                                                                           Return                                                                                                                           ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[CredentialEntry](https://developer.android.com/reference/kotlin/android/service/credentials/CredentialEntry.html#)!> | This value cannot be`null`. |

### getSupportedElementKeys

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

```
fun getSupportedElementKeys(): MutableSet<String!>
```

Returns the flattened JSON string that will be matched with requests.

|                                                                                                        Return                                                                                                         ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!> | This value cannot be`null`. |

### getType

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

```
fun getType(): String
```

Returns the type of the Credential described.

|                                                    Return                                                     ||
|----------------------------------------------------------------------------------|-----------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | This value cannot be`null`. |

### hashCode

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

```
fun hashCode(): Int
```

[getType()](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#getType())and[getSupportedElementKeys()](https://developer.android.com/reference/kotlin/android/credentials/CredentialDescription#getSupportedElementKeys())are enough for hashing. Constructor enforces[CredentialEntry](https://developer.android.com/reference/kotlin/android/service/credentials/CredentialEntry.html#)to have the same type and[android.app.slice.Slice](https://developer.android.com/reference/kotlin/android/app/slice/Slice.html#)contained by the entry can not be hashed.

|                                                     Return                                                     ||
|----------------------------------------------------------------------------|------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a hash code value for this object. |

### writeToParcel

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

```
fun writeToParcel(
    dest: Parcel, 
    flags: Int
): Unit
```

Flatten this object in to a Parcel.

|                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                     ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `dest`  | [Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#):This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Additional flags about how the object should be written. May be 0 or[PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int). Value is either`0`or a combination of[android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int), and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |

## Properties

### CREATOR

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

```
static val CREATOR: Parcelable.Creator<CredentialDescription!>
```