# BeginCreateCredentialResponse.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/service/credentials/BeginCreateCredentialResponse.Builder "View this page in Java")  

```
class Builder
```

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

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

## Summary

|                                                                 Public constructors                                                                 ||
|--------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/service/credentials/BeginCreateCredentialResponse.Builder#Builder())`()` <br /> |

|                                                                                                                                                                                                                                                                                                                 Public methods                                                                                                                                                                                                                                                                                                                 ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [BeginCreateCredentialResponse.Builder](https://developer.android.com/reference/kotlin/android/service/credentials/BeginCreateCredentialResponse.Builder#) | [addCreateEntry](https://developer.android.com/reference/kotlin/android/service/credentials/BeginCreateCredentialResponse.Builder#addCreateEntry(android.service.credentials.CreateEntry))`(`createEntry:` `[CreateEntry](https://developer.android.com/reference/kotlin/android/service/credentials/CreateEntry)`)` Adds an entry to the list of create entries to be shown on the UI.                                                                                            |
| [BeginCreateCredentialResponse](https://developer.android.com/reference/kotlin/android/service/credentials/BeginCreateCredentialResponse)                  | [build](https://developer.android.com/reference/kotlin/android/service/credentials/BeginCreateCredentialResponse.Builder#build())`()` Builds a new instance of[BeginCreateCredentialResponse](https://developer.android.com/reference/kotlin/android/service/credentials/BeginCreateCredentialResponse).                                                                                                                                                                           |
| [BeginCreateCredentialResponse.Builder](https://developer.android.com/reference/kotlin/android/service/credentials/BeginCreateCredentialResponse.Builder#) | [setCreateEntries](https://developer.android.com/reference/kotlin/android/service/credentials/BeginCreateCredentialResponse.Builder#setCreateEntries(kotlin.collections.MutableList))`(`createEntries:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[CreateEntry](https://developer.android.com/reference/kotlin/android/service/credentials/CreateEntry)!>`)` Sets the list of create entries to be shown on the UI. |
| [BeginCreateCredentialResponse.Builder](https://developer.android.com/reference/kotlin/android/service/credentials/BeginCreateCredentialResponse.Builder#) | [setRemoteCreateEntry](https://developer.android.com/reference/kotlin/android/service/credentials/BeginCreateCredentialResponse.Builder#setRemoteCreateEntry(android.service.credentials.RemoteEntry))`(`remoteCreateEntry:` `[RemoteEntry](https://developer.android.com/reference/kotlin/android/service/credentials/RemoteEntry)?`)` Sets a remote create entry to be shown on the UI.                                                                                          |

## Public constructors

### Builder

```
Builder()
```

## Public methods

### addCreateEntry

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

```
fun addCreateEntry(createEntry: CreateEntry): BeginCreateCredentialResponse.Builder
```

Adds an entry to the list of create entries to be shown on the UI.

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

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

|                        Exceptions                         ||
|----------------------------------|-------------------------|
| `java.lang.NullPointerException` | If`createEntry`is null. |

### build

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

```
fun build(): BeginCreateCredentialResponse
```

Builds a new instance of[BeginCreateCredentialResponse](https://developer.android.com/reference/kotlin/android/service/credentials/BeginCreateCredentialResponse).

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

### setCreateEntries

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

```
fun setCreateEntries(createEntries: MutableList<CreateEntry!>): BeginCreateCredentialResponse.Builder
```

Sets the list of create entries to be shown on the UI.

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

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

|                                            Exceptions                                            ||
|--------------------------------------|------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | If`createEntries`is empty.                                 |
| `java.lang.NullPointerException`     | If`createEntries`is null, or any of its elements are null. |

### setRemoteCreateEntry

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

```
fun setRemoteCreateEntry(remoteCreateEntry: RemoteEntry?): BeginCreateCredentialResponse.Builder
```

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

When constructing the[CreateEntry](https://developer.android.com/reference/kotlin/android/service/credentials/CreateEntry)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`remoteCreateEntry`, the system will invoke the`pendingIntent`set on the[CreateEntry](https://developer.android.com/reference/kotlin/android/service/credentials/CreateEntry).

Once the remote credential flow is complete, the[android.app.Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)result should be set to[android.app.Activity#RESULT_OK](https://developer.android.com/reference/kotlin/android/app/Activity.html#RESULT_OK:kotlin.Int)and an extra with the[CredentialProviderService.EXTRA_CREATE_CREDENTIAL_RESPONSE](https://developer.android.com/reference/kotlin/android/service/credentials/CredentialProviderService#EXTRA_CREATE_CREDENTIAL_RESPONSE:kotlin.String)key should be populated with a[android.credentials.CreateCredentialResponse](https://developer.android.com/reference/kotlin/android/credentials/CreateCredentialResponse.html#)object.

Note that as a provider service you will only be able to set a remote entry if : - Provider service possesses the[Manifest.permission.PROVIDE_REMOTE_CREDENTIALS](https://developer.android.com/reference/kotlin/android/Manifest.permission.html#PROVIDE_REMOTE_CREDENTIALS:kotlin.String)permission. - Provider service is configured as the provider that can provide remote entries. If the above conditions are not met, setting back[BeginCreateCredentialResponse](https://developer.android.com/reference/kotlin/android/service/credentials/BeginCreateCredentialResponse)on the callback from[CredentialProviderService.onBeginCreateCredential](https://developer.android.com/reference/kotlin/android/service/credentials/CredentialProviderService#onBeginCreateCredential(android.service.credentials.BeginCreateCredentialRequest,%20android.os.CancellationSignal,%20android.os.OutcomeReceiver))will throw a[SecurityException](https://developer.android.com/reference/kotlin/java/lang/SecurityException.html#).  
Requires[android.Manifest.permission#PROVIDE_REMOTE_CREDENTIALS](https://developer.android.com/reference/kotlin/android/Manifest.permission.html#PROVIDE_REMOTE_CREDENTIALS:kotlin.String)

|                                                                      Parameters                                                                      ||
|---------------------|---------------------------------------------------------------------------------------------------------------------------------|
| `remoteCreateEntry` | [RemoteEntry](https://developer.android.com/reference/kotlin/android/service/credentials/RemoteEntry)?:This value may be`null`. |

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