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

# BeginGetCredentialResponse.Builder

*** ** * ** ***

` public static final class BeginGetCredentialResponse.Builder `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

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

<br />

*** ** * ** ***

Builds an instance of `https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse`.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder#Builder()() ` |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder` | ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder#addAction(android.service.credentials.Action)(https://developer.android.com/reference/android/service/credentials/Action action) ` Adds an `https://developer.android.com/reference/android/service/credentials/Action` to the list of actions to be displayed on the UI. |
| ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder` | ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder#addAuthenticationAction(android.service.credentials.Action)(https://developer.android.com/reference/android/service/credentials/Action authenticationAction) ` Add an authentication entry to be shown on the UI. |
| ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder` | ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder#addCredentialEntry(android.service.credentials.CredentialEntry)(https://developer.android.com/reference/android/service/credentials/CredentialEntry credentialEntry) ` Adds a `https://developer.android.com/reference/android/service/credentials/CredentialEntry` to the list of entries to be displayed on the UI. |
| ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse` | ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder#build()() ` Builds a `https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse` instance. |
| ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder` | ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder#setActions(java.util.List<android.service.credentials.Action>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/service/credentials/Action> actions) ` Sets the list of actions to be displayed on the UI. |
| ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder` | ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder#setAuthenticationActions(java.util.List<android.service.credentials.Action>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/service/credentials/Action> authenticationActions) ` Sets the list of authentication entries to be displayed on the account selector UI. |
| ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder` | ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder#setCredentialEntries(java.util.List<android.service.credentials.CredentialEntry>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/service/credentials/CredentialEntry> credentialEntries) ` Sets the list of credential entries to be displayed on the account selector UI. |
| ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder` | ` https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse.Builder#setRemoteCredentialEntry(android.service.credentials.RemoteEntry)(https://developer.android.com/reference/android/service/credentials/RemoteEntry remoteCredentialEntry) ` Sets a remote credential entry to be shown on the UI. |

### 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

```
public Builder ()
```

<br />

<br />

## Public methods

### addAction

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

```
public BeginGetCredentialResponse.Builder addAction (Action action)
```

Adds an `https://developer.android.com/reference/android/service/credentials/Action` to the list of actions to be displayed on the UI.

An `action` must be used for independent user actions, such as opening the app, intenting directly into a certain app activity etc. The `pendingIntent` set with the `action` must invoke the corresponding activity.

<br />

| Parameters ||
|---|---|
| `action` | `Action`: This value cannot be `null`. <br /> |

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

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | If `action` is null. |

### addAuthenticationAction

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

```
public BeginGetCredentialResponse.Builder addAuthenticationAction (Action authenticationAction)
```

Add an authentication entry to be shown on the UI. Providers must set this entry if the corresponding account is locked and no underlying credentials can be returned.

When the user selects this `authenticationAction`, the system invokes the corresponding `pendingIntent`. Once the authentication action activity is launched, and the user is authenticated, providers should create another response with `https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse` using this time adding the unlocked credentials in the form of `https://developer.android.com/reference/android/service/credentials/CredentialEntry`'s.

The new response object must be set on the authentication activity's result. The result code should be set to `https://developer.android.com/reference/android/app/Activity#RESULT_OK` and the `https://developer.android.com/reference/android/service/credentials/CredentialProviderService#EXTRA_BEGIN_GET_CREDENTIAL_RESPONSE` extra should be set with the new fully populated `https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse` object.

<br />

| Parameters ||
|---|---|
| `authenticationAction` | `Action`: This value cannot be `null`. <br /> |

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

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | If `authenticationAction` is null. |

### addCredentialEntry

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

```
public BeginGetCredentialResponse.Builder addCredentialEntry (CredentialEntry credentialEntry)
```

Adds a `https://developer.android.com/reference/android/service/credentials/CredentialEntry` to the list of entries to be displayed on the UI.

<br />

| Parameters ||
|---|---|
| `credentialEntry` | `CredentialEntry`: This value cannot be `null`. <br /> |

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

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | If the `credentialEntry` is null. |

### build

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

```
public BeginGetCredentialResponse build ()
```

Builds a `https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse` instance.

<br />

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

### setActions

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

```
public BeginGetCredentialResponse.Builder setActions (List<Action> actions)
```

Sets the list of actions to be displayed on the UI.

<br />

| Parameters ||
|---|---|
| `actions` | `List`: This value cannot be `null`. <br /> |

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

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | If `actions` is null, or any of its elements is null. |

### setAuthenticationActions

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

```
public BeginGetCredentialResponse.Builder setAuthenticationActions (List<Action> authenticationActions)
```

Sets the list of authentication entries to be displayed on the account selector UI.

<br />

| Parameters ||
|---|---|
| `authenticationActions` | `List`: This value cannot be `null`. <br /> |

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

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | If `authenticationEntries` is null, or any of its elements is null. |

### setCredentialEntries

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

```
public BeginGetCredentialResponse.Builder setCredentialEntries (List<CredentialEntry> credentialEntries)
```

Sets the list of credential entries to be displayed on the account selector UI.

<br />

| Parameters ||
|---|---|
| `credentialEntries` | `List`: This value cannot be `null`. <br /> |

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

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | If `credentialEntries` is null, or any of its elements is null. |

### setRemoteCredentialEntry

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

```
public BeginGetCredentialResponse.Builder setRemoteCredentialEntry (RemoteEntry remoteCredentialEntry)
```

Sets a remote credential entry to be shown on the UI. Provider must set this if they wish to get the credential from a different device.

When constructing the `https://developer.android.com/reference/android/service/credentials/CredentialEntry` object, the `pendingIntent` must be set such that it leads to an activity that can provide UI to fulfill the request on a remote device. When user selects this `remoteCredentialEntry`, the system will invoke the `pendingIntent` set on the `https://developer.android.com/reference/android/service/credentials/CredentialEntry`.

Once the remote credential flow is complete, the `https://developer.android.com/reference/android/app/Activity` result should be set to `https://developer.android.com/reference/android/app/Activity#RESULT_OK` and an extra with the `https://developer.android.com/reference/android/service/credentials/CredentialProviderService#EXTRA_GET_CREDENTIAL_RESPONSE` key should be populated with a `https://developer.android.com/reference/android/credentials/Credential` object.

Note that as a provider service you will only be able to set a remote entry if : - Provider service possesses the `https://developer.android.com/reference/android/Manifest.permission#PROVIDE_REMOTE_CREDENTIALS` permission. - Provider service is configured as the provider that can provide remote entries. If the above conditions are not met, setting back `https://developer.android.com/reference/android/service/credentials/BeginGetCredentialResponse` on the callback from `https://developer.android.com/reference/android/service/credentials/CredentialProviderService#onBeginGetCredential(android.service.credentials.BeginGetCredentialRequest,%20android.os.CancellationSignal,%20android.os.OutcomeReceiver<android.service.credentials.BeginGetCredentialResponse,android.credentials.GetCredentialException>)` will throw a `https://developer.android.com/reference/java/lang/SecurityException`.   

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

<br />

| Parameters ||
|---|---|
| `remoteCredentialEntry` | `RemoteEntry`: This value may be `null`. <br /> |

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