# ProviderCreateCredentialRequest

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

*** ** * ** ***

<br />

```
public final class ProviderCreateCredentialRequest
```

<br />

*** ** * ** ***

Final request received by the provider after the user has selected a given `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry` on the UI.

This request contains the actual request coming from the calling app, and the application information associated with the calling app.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception/index.html` | If `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#callingRequest()`, or `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#callingAppInfo()` is null |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#ProviderCreateCredentialRequest(androidx.credentials.CreateCredentialRequest,androidx.credentials.provider.CallingAppInfo,androidx.credentials.provider.BiometricPromptResult)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest callingRequest, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CallingAppInfo callingAppInfo, https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptResult biometricPromptResult )` |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 23) https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#asBundle(androidx.credentials.provider.ProviderCreateCredentialRequest)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest request)` Helper method to convert the given `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest.Companion#asBundle(androidx.credentials.provider.ProviderCreateCredentialRequest)` to a parcelable `https://developer.android.com/reference/android/os/Bundle.html`, in case the instance needs to be sent across a process. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 23) https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#fromBundle(android.os.Bundle)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html bundle)` Helper method to convert a `https://developer.android.com/reference/android/os/Bundle.html` retrieved through `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#asBundle(androidx.credentials.provider.ProviderCreateCredentialRequest)`, back to an instance of `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest`. |
| `final https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptResult` | `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#getBiometricPromptResult()()` the result of a Biometric Prompt authentication flow, that is propagated to the provider if the provider requested for `https://developer.android.com/reference/androidx/credentials/CredentialManager` to handle the authentication flow |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CallingAppInfo` | `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#getCallingAppInfo()()` information pertaining to the calling app making the request |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest` | `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#getCallingRequest()()` the complete `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest` coming from the calling app that is requesting for credential creation |

| ### Extension functions |
|---|---|
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest.https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#(androidx.credentials.provider.ProviderCreateCredentialRequest).getSelectedEntryId()( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest receiver )` Returns the id of the entry selected by the user. |

## Public constructors

### ProviderCreateCredentialRequest

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

```
public ProviderCreateCredentialRequest(
    @NonNull CreateCredentialRequest callingRequest,
    @NonNull CallingAppInfo callingAppInfo,
    BiometricPromptResult biometricPromptResult
)
```

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception/index.html` | If `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#(androidx.credentials.CreateCredentialRequest,androidx.credentials.provider.CallingAppInfo,androidx.credentials.provider.BiometricPromptResult)`, or `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#(androidx.credentials.CreateCredentialRequest,androidx.credentials.provider.CallingAppInfo,androidx.credentials.provider.BiometricPromptResult)` is null |

## Public methods

### asBundle

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

```
@RequiresApi(value = 23)
public static final @NonNull Bundle asBundle(@NonNull ProviderCreateCredentialRequest request)
```

Helper method to convert the given `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest.Companion#asBundle(androidx.credentials.provider.ProviderCreateCredentialRequest)` to a parcelable `https://developer.android.com/reference/android/os/Bundle.html`, in case the instance needs to be sent across a process. Consumers of this method should use `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#fromBundle(android.os.Bundle)` to reconstruct the class instance back from the bundle returned here.

### fromBundle

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

```
@RequiresApi(value = 23)
public static final @NonNull ProviderCreateCredentialRequest fromBundle(@NonNull Bundle bundle)
```

Helper method to convert a `https://developer.android.com/reference/android/os/Bundle.html` retrieved through `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#asBundle(androidx.credentials.provider.ProviderCreateCredentialRequest)`, back to an instance of `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest`.

Throws `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` if the conversion fails. This means that the given `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest.Companion#fromBundle(android.os.Bundle)` does not contain a `ProviderCreateCredentialRequest`. The bundle should be constructed and retrieved from `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest#asBundle(androidx.credentials.provider.ProviderCreateCredentialRequest)` itself and never be created from scratch to avoid the failure.

### getBiometricPromptResult

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

```
public final BiometricPromptResult getBiometricPromptResult()
```

the result of a Biometric Prompt authentication flow, that is propagated to the provider if the provider requested for `https://developer.android.com/reference/androidx/credentials/CredentialManager` to handle the authentication flow

### getCallingAppInfo

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

```
public final @NonNull CallingAppInfo getCallingAppInfo()
```

information pertaining to the calling app making the request

### getCallingRequest

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

```
public final @NonNull CreateCredentialRequest getCallingRequest()
```

the complete `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest` coming from the calling app that is requesting for credential creation

## Extension functions

### ProviderCreateCredentialRequest.getSelectedEntryId

Artifact: [androidx.credentials.registry:registry-provider](https://developer.android.com/jetpack/androidx/releases/credentials-registry) [View Source](https://cs.android.com/search?q=file:androidx/credentials/registry/provider/ProviderCreateCredentialRequest.kt+symbol:selectedEntryId)

```
public final String ProviderCreateCredentialRequest.getSelectedEntryId(
    @NonNull ProviderCreateCredentialRequest receiver
)
```

Returns the id of the entry selected by the user.

A null return means that entry ID isn't supported for the given type of the use case at all.

For how to handle a user selection and extract the `https://developer.android.com/reference/androidx/credentials/provider/ProviderCreateCredentialRequest` containing the selection information, see `https://developer.android.com/reference/androidx/credentials/registry/provider/RegistryManager#ACTION_CREATE_CREDENTIAL()`.