Stay organized with collections Save and categorize content based on your preferences.

Action

@RequiresApi(value = 34)
public final class Action extends Action


An actionable entry that is returned as part of the android.service.credentials.BeginGetCredentialResponse, and then shown on the user selector. An action entry is expected to navigate the user to the credential provider's activity, and ultimately result in a androidx.credentials.GetCredentialResponse through that activity.

When selected, the associated PendingIntent is invoked to launch a provider controlled activity. The activity invoked due to this pending intent will contain the android.service.credentials.BeginGetCredentialRequest as part of the intent extras. Providers must use PendingIntentHandler.retrieveBeginGetCredentialRequest to get the request.

When the user is done interacting with the activity and the provider has a credential to return, provider must call android.app.Activity.setResult with the result code as android.app.Activity.RESULT_OK, and the android.content.Intent data that has been prepared by using PendingIntentHandler.setGetCredentialResponse, before ending the activity. If the provider does not have a credential to return, provider must call android.app.Activity.setResult with the result code as android.app.Activity.RESULT_CANCELED.

Examples of Action entries include an entry that is titled 'Add a new Password', and navigates to the 'add password' page of the credential provider app, or an entry that is titled 'Manage Credentials' and navigates to a particular page that lists all credentials, where the user may end up selecting a credential that the provider can then return.

Throws
kotlin.IllegalArgumentException kotlin.IllegalArgumentException

If title is empty

kotlin.NullPointerException kotlin.NullPointerException

If title or pendingIntent is null

See also
BeginGetCredentialResponse

for usage.

Summary

Nested types

public final class Action.Builder

A builder for Action

public static class Action.Companion

Public fields

static final @NonNull Parcelable.Creator<@NonNull Action>

Public constructors

Action(
    @NonNull CharSequence title,
    @NonNull PendingIntent pendingIntent,
    CharSequence subtitle
)

Public methods

int
final @NonNull PendingIntent

the PendingIntent that will be invoked when the user selects this entry

final CharSequence

the optional subtitle that is displayed on the entry

final @NonNull CharSequence

the title of the entry

void
writeToParcel(@NonNull Parcel dest, int flags)

Public fields

CREATOR

public static final @NonNull Parcelable.Creator<@NonNull ActionCREATOR

Public constructors

Action

public Action(
    @NonNull CharSequence title,
    @NonNull PendingIntent pendingIntent,
    CharSequence subtitle
)

Public methods

describeContents

public int describeContents()

getPendingIntent

public final @NonNull PendingIntent getPendingIntent()

the PendingIntent that will be invoked when the user selects this entry

getSubtitle

public final CharSequence getSubtitle()

the optional subtitle that is displayed on the entry

getTitle

public final @NonNull CharSequence getTitle()

the title of the entry

writeToParcel

public void writeToParcel(@NonNull Parcel dest, int flags)