BeginCreateCredentialResponse.Builder


public final class BeginCreateCredentialResponse.Builder


Builder for BeginCreateCredentialResponse.

Summary

Public constructors

Public methods

final @NonNull BeginCreateCredentialResponse.Builder

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

final @NonNull BeginCreateCredentialResponse

Builds a new instance of BeginCreateCredentialResponse.

final @NonNull BeginCreateCredentialResponse.Builder

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

final @NonNull BeginCreateCredentialResponse.Builder

Sets a remote create entry to be shown on the UI.

Public constructors

Builder

Added in 1.2.0
public Builder()

Public methods

addCreateEntry

Added in 1.2.0
public final @NonNull BeginCreateCredentialResponse.Builder addCreateEntry(@NonNull CreateEntry createEntry)

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

build

Added in 1.2.0
public final @NonNull BeginCreateCredentialResponse build()

Builds a new instance of BeginCreateCredentialResponse.

setCreateEntries

Added in 1.2.0
public final @NonNull BeginCreateCredentialResponse.Builder setCreateEntries(@NonNull List<@NonNull CreateEntry> createEntries)

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

Throws
kotlin.IllegalArgumentException

If createEntries is empty.

kotlin.NullPointerException

If createEntries is null, or any of its elements are null.

setRemoteEntry

Added in 1.2.0
public final @NonNull BeginCreateCredentialResponse.Builder setRemoteEntry(RemoteEntry remoteEntry)

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 {@link CreateEntry] object, the pending intent 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 [remoteEntry], the system will invoke the pending intent set on the [CreateEntry].

Once the remote credential flow is complete, the [android.app.Activity] result should be set to [android.app.Activity#RESULT_OK] and an extra with the [CredentialProviderService#EXTRA_CREATE_CREDENTIAL_RESPONSE] key should be populated with a [android.credentials.CreateCredentialResponse] object.

Note that as a provider service you will only be able to set a remote entry if : - Provider service possesses the [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 BeginCreateCredentialResponse on the callback from CredentialProviderService#onBeginCreateCredential will throw a SecurityException.