Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/credentials/CreateCredentialRequest.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/credentials/CreateCredentialRequest.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/credentials/CreateCredentialRequest.Builder#inhmethods)

# CreateCredentialRequest.Builder

*** ** * ** ***


`
public
static
final

class
CreateCredentialRequest.Builder
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

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

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/android/credentials/CreateCredentialRequest`.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/credentials/CreateCredentialRequest.Builder#Builder(java.lang.String,%20android.os.Bundle,%20android.os.Bundle)(https://developer.android.com/reference/java/lang/String type, https://developer.android.com/reference/android/os/Bundle credentialData, https://developer.android.com/reference/android/os/Bundle candidateQueryData) ` |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/credentials/CreateCredentialRequest` | ` https://developer.android.com/reference/android/credentials/CreateCredentialRequest.Builder#build()() ` Builds a `https://developer.android.com/reference/android/credentials/GetCredentialRequest`. |
| ` https://developer.android.com/reference/android/credentials/CreateCredentialRequest.Builder` | ` https://developer.android.com/reference/android/credentials/CreateCredentialRequest.Builder#setAlwaysSendAppInfoToProvider(boolean)(boolean value) ` Sets a true/false value to determine if the calling app info should be removed from the request that is sent to the providers. |
| ` https://developer.android.com/reference/android/credentials/CreateCredentialRequest.Builder` | ` https://developer.android.com/reference/android/credentials/CreateCredentialRequest.Builder#setIsSystemProviderRequired(boolean)(boolean value) ` Sets whether the request must only be fulfilled by a system provider. |
| ` https://developer.android.com/reference/android/credentials/CreateCredentialRequest.Builder` | ` https://developer.android.com/reference/android/credentials/CreateCredentialRequest.Builder#setOrigin(java.lang.String)(https://developer.android.com/reference/java/lang/String origin) ` Sets the origin of the calling app. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` 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 https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` 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` | ` 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` | ` 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*. | ||

## Public constructors

### Builder

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

```
public Builder (String type, 
                Bundle credentialData, 
                Bundle candidateQueryData)
```

<br />

<br />

| Parameters ||
|---|---|
| `type` | `String`: the type of the credential to be stored. This value cannot be `null`. <br /> |
| `credentialData` | `Bundle`: the full credential creation request data, which must at minimum contain the required fields observed at the `https://developer.android.com/reference/androidx/credentials/CreateCredentialRequest.html` Bundle conversion static methods, because they are required for properly displaying the system credential selector UI. This value cannot be `null`. <br /> |
| `candidateQueryData` | `Bundle`: the partial request data that will be sent to the provider during the initial creation candidate query stage. This value cannot be `null`. <br /> |

## Public methods

### build

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

```
public CreateCredentialRequest build ()
```

Builds a `https://developer.android.com/reference/android/credentials/GetCredentialRequest`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/credentials/CreateCredentialRequest` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If credentialOptions is empty. |

### setAlwaysSendAppInfoToProvider

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

```
public CreateCredentialRequest.Builder setAlwaysSendAppInfoToProvider (boolean value)
```

Sets a true/false value to determine if the calling app info should be
removed from the request that is sent to the providers.

Developers must set this to false if they wish to remove the
`https://developer.android.com/reference/android/service/credentials/CallingAppInfo` from the query phases requests that
providers receive. Note that the calling app info will still be sent in the
final phase after the user has made a selection on the UI.

If not set, the default value will be true and the calling app info will be
propagated to the providers in every phase.

<br />

| Parameters ||
|---|---|
| `value` | `boolean` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/credentials/CreateCredentialRequest.Builder` | This value cannot be `null`. <br /> |

### setIsSystemProviderRequired

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

```
public CreateCredentialRequest.Builder setIsSystemProviderRequired (boolean value)
```

Sets whether the request must only be fulfilled by a system provider.
This defaults to false

<br />

| Parameters ||
|---|---|
| `value` | `boolean` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/credentials/CreateCredentialRequest.Builder` | This value cannot be `null`. <br /> |

### setOrigin

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

```
public CreateCredentialRequest.Builder setOrigin (String origin)
```

Sets the origin of the calling app. Callers of this special setter (e.g. browsers)
can set this origin for an app different from their own, to be able to get
credentials on behalf of that app. The permission check only happens later when this
instance is passed and processed by the Credential Manager.


Requires `https://developer.android.com/reference/android/Manifest.permission#CREDENTIAL_MANAGER_SET_ORIGIN`

<br />

| Parameters ||
|---|---|
| `origin` | `String`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/credentials/CreateCredentialRequest.Builder` | This value cannot be `null`. <br /> |