# CreateCustomCredentialRequest

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

*** ** * ** ***


```
public class CreateCustomCredentialRequest extends CreateCredentialRequest
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.credentials.CreateCredentialRequest](https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest) ||
|   | ↳ | [androidx.credentials.CreateCustomCredentialRequest](https://developer.android.com/reference/androidx/credentials/CreateCustomCredentialRequest) |

*** ** * ** ***

Base custom create request class for registering a credential.

An application can construct a subtype custom request and call `https://developer.android.com/reference/androidx/credentials/CredentialManager#createCredential(android.content.Context,androidx.credentials.CreateCredentialRequest)` to launch framework UI flows to collect consent and any other metadata needed from the user to register a new user credential.

If you get a `https://developer.android.com/reference/androidx/credentials/CreateCustomCredentialRequest` instead of a type-safe request class such as `https://developer.android.com/reference/androidx/credentials/CreatePasswordRequest`, `https://developer.android.com/reference/androidx/credentials/CreatePublicKeyCredentialRequest`, etc., then you should check if you have any other library at interest that supports this custom `https://developer.android.com/reference/androidx/credentials/CreateCustomCredentialRequest#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,androidx.credentials.CreateCredentialRequest.DisplayInfo,kotlin.Boolean,kotlin.String,kotlin.Boolean)` of credential request, and if so use its parsing utilities to resolve to a type-safe class within that library.

Note: The Bundle keys for `https://developer.android.com/reference/androidx/credentials/CreateCustomCredentialRequest#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,androidx.credentials.CreateCredentialRequest.DisplayInfo,kotlin.Boolean,kotlin.String,kotlin.Boolean)` and `https://developer.android.com/reference/androidx/credentials/CreateCustomCredentialRequest#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,androidx.credentials.CreateCredentialRequest.DisplayInfo,kotlin.Boolean,kotlin.String,kotlin.Boolean)` should not be in the form of androidx.credentials.\*\` as they are reserved for internal use by this androidx library.

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/credentials/CreateCustomCredentialRequest#CreateCustomCredentialRequest(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,androidx.credentials.CreateCredentialRequest.DisplayInfo,kotlin.Boolean,kotlin.String,kotlin.Boolean)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html type, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html credentialData, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html candidateQueryData, boolean isSystemProviderRequired, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo displayInfo, boolean isAutoSelectAllowed, https://developer.android.com/reference/java/lang/String.html origin, boolean preferImmediatelyAvailableCredentials )` |

| ### Inherited methods |
|---|
| From [androidx.credentials.CreateCredentialRequest](https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest) |---|---| | `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest#getCandidateQueryData()()` the partial request data in the `https://developer.android.com/reference/android/os/Bundle.html` format that will be sent to the provider during the initial candidate query stage, which should not contain sensitive user credential information (note: bundle keys in the form of `androidx.credentials.*` are reserved for internal library use) | | `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest#getCredentialData()()` the request data in the `https://developer.android.com/reference/android/os/Bundle.html` format | | `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo` | `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest#getDisplayInfo()()` the information to be displayed on the screen | | `final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest#getOrigin()()` the origin of a different application if the request is being made on behalf of that application (Note: for API level \>=34, setting a non-null value for this parameter will throw a SecurityException if android.permission.CREDENTIAL_MANAGER_SET_ORIGIN is not present) | | `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest#getType()()` the credential type determined by the credential-type-specific subclass (e.g. the type for `https://developer.android.com/reference/androidx/credentials/CreatePasswordRequest` is `https://developer.android.com/reference/androidx/credentials/PasswordCredential#TYPE_PASSWORD_CREDENTIAL()` and for `https://developer.android.com/reference/androidx/credentials/CreatePublicKeyCredentialRequest` is `https://developer.android.com/reference/androidx/credentials/PublicKeyCredential#TYPE_PUBLIC_KEY_CREDENTIAL()`) | | `final boolean` | `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest#isAutoSelectAllowed()()` whether a create option will be automatically chosen if it is the only one available to the user | | `final boolean` | `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest#isSystemProviderRequired()()` true if must only be fulfilled by a system provider and false otherwise | | `final boolean` | `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest#preferImmediatelyAvailableCredentials()()` true if you prefer the operation to return immediately when there is no available passkey registration offering instead of falling back to discovering remote options, and false (preferred by default) otherwise | |

## Public constructors

### CreateCustomCredentialRequest

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

```
public CreateCustomCredentialRequest(
    @NonNull String type,
    @NonNull Bundle credentialData,
    @NonNull Bundle candidateQueryData,
    boolean isSystemProviderRequired,
    @NonNull CreateCredentialRequest.DisplayInfo displayInfo,
    boolean isAutoSelectAllowed,
    String origin,
    boolean preferImmediatelyAvailableCredentials
)
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html type` | the credential type determined by the credential-type-specific subclass for custom use cases |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html credentialData` | the data of this `https://developer.android.com/reference/androidx/credentials/CreateCustomCredentialRequest` in the `https://developer.android.com/reference/android/os/Bundle.html` format (note: bundle keys in the form of `androidx.credentials.*` and `android.credentials.*` are reserved for internal library usage) |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html candidateQueryData` | the partial request data in the `https://developer.android.com/reference/android/os/Bundle.html` format that will be sent to the provider during the initial candidate query stage, which should not contain sensitive user credential information (note: bundle keys in the form of `androidx.credentials.*` and `android.credentials.*` are reserved for internal library usage) |
| `boolean isSystemProviderRequired` | true if must only be fulfilled by a system provider and false otherwise |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.DisplayInfo displayInfo` | the information to be displayed on the screen |
| `boolean isAutoSelectAllowed` | defines if a create entry will be automatically chosen if it is the only one available option, false by default |
| `https://developer.android.com/reference/java/lang/String.html origin` | the origin of a different application if the request is being made on behalf of that application (Note: for API level \>=34, setting a non-null value for this parameter will throw a SecurityException if android.permission.CREDENTIAL_MANAGER_SET_ORIGIN is not present) |
| `boolean preferImmediatelyAvailableCredentials` | true if you prefer the operation to return immediately when there is no available passkey registration offering instead of falling back to discovering remote options, and false (default) otherwise |