# CreateCredentialRequest.DisplayInfo

Artifact: [androidx.credentials:credentials](https://developer.android.com/jetpack/androidx/releases/credentials) [View Source](https://cs.android.com/search?q=file:androidx/credentials/CreateCredentialRequest.kt+class:androidx.credentials.CreateCredentialRequest.DisplayInfo) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

*** ** * ** ***

<br />

```
public final class CreateCredentialRequest.DisplayInfo
```

<br />

*** ** * ** ***

Information that may be used for display purposes when rendering UIs to collect the user consent and choice.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo#DisplayInfo(kotlin.CharSequence,kotlin.CharSequence)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html userId, https://developer.android.com/reference/java/lang/CharSequence.html userDisplayName)` Constructs a `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo`. |
| `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo#DisplayInfo(kotlin.CharSequence,kotlin.CharSequence,kotlin.String)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html userId, https://developer.android.com/reference/java/lang/CharSequence.html userDisplayName, https://developer.android.com/reference/java/lang/String.html preferDefaultProvider )` Constructs a `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo`. |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 23) https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo#createFrom(android.os.Bundle)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html from)` Returns a RequestDisplayInfo from a `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest#credentialData()` Bundle. |
| `final https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo#getUserDisplayName()()` an optional display name in addition to the `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo#userId()` that may be displayed next to the `userId` during the user consent to help your user better understand the credential being created |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo#getUserId()()` the user identifier of the created credential |

## Public constructors

### DisplayInfo

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

```
public DisplayInfo(@NonNull CharSequence userId, CharSequence userDisplayName)
```

Constructs a `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html userId` | the user id of the created credential |
| `https://developer.android.com/reference/java/lang/CharSequence.html userDisplayName` | an optional display name in addition to the `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo#(kotlin.CharSequence,kotlin.CharSequence)` that may be displayed next to the `userId` during the user consent to help your user better understand the credential being created |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo#(kotlin.CharSequence,kotlin.CharSequence)` is empty |

### DisplayInfo

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

```
public DisplayInfo(
    @NonNull CharSequence userId,
    CharSequence userDisplayName,
    String preferDefaultProvider
)
```

Constructs a `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html userId` | the user id of the created credential |
| `https://developer.android.com/reference/java/lang/CharSequence.html userDisplayName` | an optional display name in addition to the `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo#(kotlin.CharSequence,kotlin.CharSequence,kotlin.String)` that may be displayed next to the `userId` during the user consent to help your user better understand the credential being created |
| `https://developer.android.com/reference/java/lang/String.html preferDefaultProvider` | the preferred default provider component name to prioritize in the selection UI flows. Your app must have the permission android.permission.CREDENTIAL_MANAGER_SET_ALLOWED_PROVIDERS to specify this, or it would not take effect. Also this bit may not take effect for Android API level 33 and below, depending on the pre-34 provider(s) you have chosen. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo#(kotlin.CharSequence,kotlin.CharSequence,kotlin.String)` is empty |

## Public methods

### createFrom

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.3.0)

```
@RequiresApi(value = 23)
public static final @NonNull CreateCredentialRequest.DisplayInfo createFrom(@NonNull Bundle from)
```

Returns a RequestDisplayInfo from a `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest#credentialData()` Bundle.

It is recommended to construct a DisplayInfo by direct constructor calls, instead of using this API. This API should only be used by a small subset of system apps that reconstruct an existing object for user interactions such as collecting consents.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html from` | the raw display data in the Bundle format, retrieved from `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest#credentialData()` |

### getUserDisplayName

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

```
public final CharSequence getUserDisplayName()
```

an optional display name in addition to the `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo#userId()` that may be displayed next to the `userId` during the user consent to help your user better understand the credential being created

### getUserId

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

```
public final @NonNull CharSequence getUserId()
```

the user identifier of the created credential