BeginCreateCredentialResponse.Builder


public static final class BeginCreateCredentialResponse.Builder
extends Object

java.lang.Object
   ↳ android.service.credentials.BeginCreateCredentialResponse.Builder


A builder for BeginCreateCredentialResponse

Summary

Public constructors

Builder()

Public methods

BeginCreateCredentialResponse.Builder addCreateEntry(CreateEntry createEntry)

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

BeginCreateCredentialResponse build()

Builds a new instance of BeginCreateCredentialResponse.

BeginCreateCredentialResponse.Builder setCreateEntries(List<CreateEntry> createEntries)

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

BeginCreateCredentialResponse.Builder setRemoteCreateEntry(RemoteEntry remoteCreateEntry)

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

Inherited methods

Public constructors

Builder

public Builder ()

Public methods

addCreateEntry

Added in API level 34
public BeginCreateCredentialResponse.Builder addCreateEntry (CreateEntry createEntry)

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

Parameters
createEntry CreateEntry: This value cannot be null.

Returns
BeginCreateCredentialResponse.Builder This value cannot be null.

Throws
NullPointerException If createEntry is null.

build

Added in API level 34
public BeginCreateCredentialResponse build ()

Builds a new instance of BeginCreateCredentialResponse.

Returns
BeginCreateCredentialResponse This value cannot be null.

setCreateEntries

Added in API level 34
public BeginCreateCredentialResponse.Builder setCreateEntries (List<CreateEntry> createEntries)

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

Parameters
createEntries List: This value cannot be null.

Returns
BeginCreateCredentialResponse.Builder This value cannot be null.

Throws
IllegalArgumentException If createEntries is empty.
NullPointerException If createEntries is null, or any of its elements are null.

setRemoteCreateEntry

Added in API level 34
public BeginCreateCredentialResponse.Builder setRemoteCreateEntry (RemoteEntry remoteCreateEntry)

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

Once the remote credential flow is complete, the Activity result should be set to Activity.RESULT_OK and an extra with the CredentialProviderService.EXTRA_CREATE_CREDENTIAL_RESPONSE key should be populated with a CreateCredentialResponse 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 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.
Requires Manifest.permission.PROVIDE_REMOTE_CREDENTIALS

Parameters
remoteCreateEntry RemoteEntry: This value may be null.

Returns
BeginCreateCredentialResponse.Builder This value cannot be null.