BeginGetCredentialResponse.Builder


public static final class BeginGetCredentialResponse.Builder
extends Object

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


Builds an instance of BeginGetCredentialResponse.

Summary

Public constructors

Builder()

Public methods

BeginGetCredentialResponse.Builder addAction(Action action)

Adds an Action to the list of actions to be displayed on the UI.

BeginGetCredentialResponse.Builder addAuthenticationAction(Action authenticationAction)

Add an authentication entry to be shown on the UI.

BeginGetCredentialResponse.Builder addCredentialEntry(CredentialEntry credentialEntry)

Adds a CredentialEntry to the list of entries to be displayed on the UI.

BeginGetCredentialResponse build()

Builds a BeginGetCredentialResponse instance.

BeginGetCredentialResponse.Builder setActions(List<Action> actions)

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

BeginGetCredentialResponse.Builder setAuthenticationActions(List<Action> authenticationActions)

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

BeginGetCredentialResponse.Builder setCredentialEntries(List<CredentialEntry> credentialEntries)

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

BeginGetCredentialResponse.Builder setRemoteCredentialEntry(RemoteEntry remoteCredentialEntry)

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

Inherited methods

Public constructors

Builder

public Builder ()

Public methods

addAction

Added in API level 34
public BeginGetCredentialResponse.Builder addAction (Action action)

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

Parameters
action Action: This value cannot be null.

Returns
BeginGetCredentialResponse.Builder This value cannot be null.

Throws
NullPointerException If action is null.

addAuthenticationAction

Added in API level 34
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 BeginGetCredentialResponse using this time adding the unlocked credentials in the form of CredentialEntry's.

The new response object must be set on the authentication activity's result. The result code should be set to Activity.RESULT_OK and the CredentialProviderService.EXTRA_BEGIN_GET_CREDENTIAL_RESPONSE extra should be set with the new fully populated BeginGetCredentialResponse object.

Parameters
authenticationAction Action: This value cannot be null.

Returns
BeginGetCredentialResponse.Builder This value cannot be null.

Throws
NullPointerException If authenticationAction is null.

addCredentialEntry

Added in API level 34
public BeginGetCredentialResponse.Builder addCredentialEntry (CredentialEntry credentialEntry)

Adds a CredentialEntry to the list of entries to be displayed on the UI.

Parameters
credentialEntry CredentialEntry: This value cannot be null.

Returns
BeginGetCredentialResponse.Builder This value cannot be null.

Throws
NullPointerException If the credentialEntry is null.

build

Added in API level 34
public BeginGetCredentialResponse build ()

Builds a BeginGetCredentialResponse instance.

Returns
BeginGetCredentialResponse This value cannot be null.

setActions

Added in API level 34
public BeginGetCredentialResponse.Builder setActions (List<Action> actions)

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

Parameters
actions List: This value cannot be null.

Returns
BeginGetCredentialResponse.Builder This value cannot be null.

Throws
NullPointerException If actions is null, or any of its elements is null.

setAuthenticationActions

Added in API level 34
public BeginGetCredentialResponse.Builder setAuthenticationActions (List<Action> authenticationActions)

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

Parameters
authenticationActions List: This value cannot be null.

Returns
BeginGetCredentialResponse.Builder This value cannot be null.

Throws
NullPointerException If authenticationEntries is null, or any of its elements is null.

setCredentialEntries

Added in API level 34
public BeginGetCredentialResponse.Builder setCredentialEntries (List<CredentialEntry> credentialEntries)

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

Parameters
credentialEntries List: This value cannot be null.

Returns
BeginGetCredentialResponse.Builder This value cannot be null.

Throws
NullPointerException If credentialEntries is null, or any of its elements is null.

setRemoteCredentialEntry

Added in API level 34
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 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 CredentialEntry.

Once the remote credential flow is complete, the Activity result should be set to Activity.RESULT_OK and an extra with the CredentialProviderService.EXTRA_GET_CREDENTIAL_RESPONSE key should be populated with a Credential 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 BeginGetCredentialResponse on the callback from CredentialProviderService.onBeginGetCredential will throw a SecurityException.
Requires Manifest.permission.PROVIDE_REMOTE_CREDENTIALS

Parameters
remoteCredentialEntry RemoteEntry: This value may be null.

Returns
BeginGetCredentialResponse.Builder This value cannot be null.