# GetCredentialRequest.Builder

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

# Builder

*** ** * ** ***

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

```
class Builder
```

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

A builder for[GetCredentialRequest](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest).

## Summary

|                                                                                                              Public constructors                                                                                                              ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest.Builder#Builder(android.os.Bundle))`(`data:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)`)` <br /> |

|                                                                                                                                                                                                                                                                                                                                   Public methods                                                                                                                                                                                                                                                                                                                                    ||
|----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [GetCredentialRequest.Builder](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest.Builder#) | [addCredentialOption](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest.Builder#addCredentialOption(android.credentials.CredentialOption))`(`credentialOption:` `[CredentialOption](https://developer.android.com/reference/kotlin/android/credentials/CredentialOption)`)` Adds a specific type of[CredentialOption](https://developer.android.com/reference/kotlin/android/credentials/CredentialOption).                                                                                                 |
| [GetCredentialRequest](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest)                  | [build](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest.Builder#build())`()` Builds a[GetCredentialRequest](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest).                                                                                                                                                                                                                                                                                                     |
| [GetCredentialRequest.Builder](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest.Builder#) | [setAlwaysSendAppInfoToProvider](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest.Builder#setAlwaysSendAppInfoToProvider(kotlin.Boolean))`(`value:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets a true/false value to determine if the calling app info should be removed from the request that is sent to the providers.                                                                                                                                  |
| [GetCredentialRequest.Builder](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest.Builder#) | [setCredentialOptions](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest.Builder#setCredentialOptions(kotlin.collections.MutableList))`(`credentialOptions:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[CredentialOption](https://developer.android.com/reference/kotlin/android/credentials/CredentialOption)!>`)` Sets the list of[CredentialOption](https://developer.android.com/reference/kotlin/android/credentials/CredentialOption). |
| [GetCredentialRequest.Builder](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest.Builder#) | [setOrigin](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest.Builder#setOrigin(kotlin.String))`(`origin:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Sets the origin of the calling app.                                                                                                                                                                                                                                                                         |

## Public constructors

### Builder

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

```
Builder(data: Bundle)
```

|                                                                   Parameters                                                                    ||
|--------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `data` | [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#):the top request level data This value cannot be`null`. |

## Public methods

### addCredentialOption

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

```
fun addCredentialOption(credentialOption: CredentialOption): GetCredentialRequest.Builder
```

Adds a specific type of[CredentialOption](https://developer.android.com/reference/kotlin/android/credentials/CredentialOption).

|                                                                       Parameters                                                                        ||
|--------------------|-------------------------------------------------------------------------------------------------------------------------------------|
| `credentialOption` | [CredentialOption](https://developer.android.com/reference/kotlin/android/credentials/CredentialOption):This value cannot be`null`. |

|                                                                            Return                                                                             ||
|----------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [GetCredentialRequest.Builder](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest.Builder#) | This value cannot be`null`. |

### build

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

```
fun build(): GetCredentialRequest
```

Builds a[GetCredentialRequest](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest).

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [GetCredentialRequest](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest) | This value cannot be`null`. |

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

### setAlwaysSendAppInfoToProvider

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

```
fun setAlwaysSendAppInfoToProvider(value: Boolean): GetCredentialRequest.Builder
```

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[android.service.credentials.CallingAppInfo](https://developer.android.com/reference/kotlin/android/service/credentials/CallingAppInfo.html#)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.

|                                                                            Return                                                                             ||
|----------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [GetCredentialRequest.Builder](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest.Builder#) | This value cannot be`null`. |

### setCredentialOptions

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

```
fun setCredentialOptions(credentialOptions: MutableList<CredentialOption!>): GetCredentialRequest.Builder
```

Sets the list of[CredentialOption](https://developer.android.com/reference/kotlin/android/credentials/CredentialOption).

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

|                                                                            Return                                                                             ||
|----------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [GetCredentialRequest.Builder](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest.Builder#) | This value cannot be`null`. |

### setOrigin

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

```
fun setOrigin(origin: String): GetCredentialRequest.Builder
```

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[android.Manifest.permission#CREDENTIAL_MANAGER_SET_ORIGIN](https://developer.android.com/reference/kotlin/android/Manifest.permission.html#CREDENTIAL_MANAGER_SET_ORIGIN:kotlin.String)

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

|                                                                            Return                                                                             ||
|----------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [GetCredentialRequest.Builder](https://developer.android.com/reference/kotlin/android/credentials/GetCredentialRequest.Builder#) | This value cannot be`null`. |