ActivityResultContracts.StartIntentSenderForResult


public final class ActivityResultContracts.StartIntentSenderForResult extends ActivityResultContract


An ActivityResultContract that calls Activity.startIntentSender.

This ActivityResultContract takes an IntentSenderRequest, which must be constructed using an IntentSenderRequest.Builder.

If the call to Activity.startIntentSenderForResult throws an android.content.IntentSender.SendIntentException the androidx.activity.result.ActivityResultCallback will receive an ActivityResult with an Activity.RESULT_CANCELED resultCode and whose intent has the action of ACTION_INTENT_SENDER_REQUEST and an extra EXTRA_SEND_INTENT_EXCEPTION that contains the thrown exception.

Summary

Constants

static final @NonNull String

An Intent action for making a request via the Activity.startIntentSenderForResult API.

static final @NonNull String

Key for the extra containing the IntentSenderRequest.

static final @NonNull String

Key for the extra containing the android.content.IntentSender.SendIntentException if the call to Activity.startIntentSenderForResult fails.

Public constructors

Public methods

@NonNull Intent

Create an intent that can be used for android.app.Activity.startActivityForResult.

@NonNull ActivityResult
parseResult(int resultCode, Intent intent)

Convert result obtained from android.app.Activity.onActivityResult to O.

Inherited methods

From androidx.activity.result.contract.ActivityResultContract
ActivityResultContract.SynchronousResult<@NonNull ActivityResult>

An optional method you can implement that can be used to potentially provide a result in lieu of starting an activity.

Constants

ACTION_INTENT_SENDER_REQUEST

public static final @NonNull String ACTION_INTENT_SENDER_REQUEST

An Intent action for making a request via the Activity.startIntentSenderForResult API.

EXTRA_INTENT_SENDER_REQUEST

public static final @NonNull String EXTRA_INTENT_SENDER_REQUEST

Key for the extra containing the IntentSenderRequest.

EXTRA_SEND_INTENT_EXCEPTION

public static final @NonNull String EXTRA_SEND_INTENT_EXCEPTION

Key for the extra containing the android.content.IntentSender.SendIntentException if the call to Activity.startIntentSenderForResult fails.

Public constructors

StartIntentSenderForResult

Added in 1.2.0
public StartIntentSenderForResult()

Public methods

createIntent

Added in 1.2.0
public @NonNull Intent createIntent(@NonNull Context context, @NonNull IntentSenderRequest input)

Create an intent that can be used for android.app.Activity.startActivityForResult.

parseResult

public @NonNull ActivityResult parseResult(int resultCode, Intent intent)

Convert result obtained from android.app.Activity.onActivityResult to O.