AppInteractionManager


public final class AppInteractionManager
extends Object

java.lang.Object
   ↳ android.app.AppInteractionManager


Provides access to App Interaction access control APIs.

Summary

Constants

String ACTION_MANAGE_APP_INTERACTION_ACCESS

Activity action: Launches a UI that shows list of all interactors and provides management of App Interaction access of those interactors.

String ACTION_MANAGE_INTERACTOR_ACCESS

Activity action: Launches a UI that shows a list of all targets that the specified interactor package can access, and provides management of App Interaction access of those targets.

String ACTION_MANAGE_INTERACTOR_TARGET_ACCESS

Activity action: Launches a UI that provides management of App Interaction access of a specific interactor to a specific target.

String ACTION_MANAGE_TARGET_ACCESS

Activity action: Launches a UI that shows list of all interactors for a specific target and provides management of App Interaction access by those interactors.

String EXTRA_INTERACTOR_PACKAGE_NAME

Intent extra: A String specifying the package name of the interactor when requesting or managing App Interaction access.

String EXTRA_TARGET_PACKAGE_NAME

Intent extra: A String specifying the target package name when managing App Interaction access.

Public methods

void createSession(AppInteractionSession.CreateParams params, Executor executor, OutcomeReceiver<AppInteractionSessionAppInteractionException> callback)

Creates an app interaction session for the given params.

Inherited methods

Constants

ACTION_MANAGE_APP_INTERACTION_ACCESS

Added in version 37.2
public static final String ACTION_MANAGE_APP_INTERACTION_ACCESS

Activity action: Launches a UI that shows list of all interactors and provides management of App Interaction access of those interactors.

Input: Nothing.

Output: Nothing.

Constant Value: "android.app.action.MANAGE_APP_INTERACTION_ACCESS"

ACTION_MANAGE_INTERACTOR_ACCESS

Added in version 37.2
public static final String ACTION_MANAGE_INTERACTOR_ACCESS

Activity action: Launches a UI that shows a list of all targets that the specified interactor package can access, and provides management of App Interaction access of those targets.

Input: EXTRA_INTERACTOR_PACKAGE_NAME specifies the package whose access will be managed by the launched UI.

Output: Nothing.

Constant Value: "android.app.action.MANAGE_INTERACTOR_ACCESS"

ACTION_MANAGE_INTERACTOR_TARGET_ACCESS

Added in version 37.2
public static final String ACTION_MANAGE_INTERACTOR_TARGET_ACCESS

Activity action: Launches a UI that provides management of App Interaction access of a specific interactor to a specific target.

Input: EXTRA_INTERACTOR_PACKAGE_NAME specifies the interactor package name.

Input: EXTRA_TARGET_PACKAGE_NAME specifies the target package name.

Output: Nothing.

Constant Value: "android.app.action.MANAGE_INTERACTOR_TARGET_ACCESS"

ACTION_MANAGE_TARGET_ACCESS

Added in version 37.2
public static final String ACTION_MANAGE_TARGET_ACCESS

Activity action: Launches a UI that shows list of all interactors for a specific target and provides management of App Interaction access by those interactors.

Input: EXTRA_TARGET_PACKAGE_NAME specifies the package whose access will be managed by the launched UI.

Output: Nothing.

Constant Value: "android.app.action.MANAGE_TARGET_ACCESS"

EXTRA_INTERACTOR_PACKAGE_NAME

Added in version 37.2
public static final String EXTRA_INTERACTOR_PACKAGE_NAME

Intent extra: A String specifying the package name of the interactor when requesting or managing App Interaction access.

Constant Value: "android.app.extra.INTERACTOR_PACKAGE_NAME"

EXTRA_TARGET_PACKAGE_NAME

Added in version 37.2
public static final String EXTRA_TARGET_PACKAGE_NAME

Intent extra: A String specifying the target package name when managing App Interaction access.

Constant Value: "android.app.extra.TARGET_PACKAGE_NAME"

Public methods

createSession

Added in version 37.2
public void createSession (AppInteractionSession.CreateParams params, 
                Executor executor, 
                OutcomeReceiver<AppInteractionSessionAppInteractionException> callback)

Creates an app interaction session for the given params.

Example usage:

AppInteractionSession.CreateParams createSessionParams =
    new AppInteractionSession.CreateParams.Builder()
        .setOnStartIntentSenderCallback(
            executor,
            intentSender -> {
                // The callback will be invoked if the session creation requires user consent
                try {
                    context.startIntentSender(intentSender, null, 0, 0, 0);
                } catch (IntentSender.SendIntentException e) {
                    // Handle exception
                }
            }
        )
        .setTargetPackages(Arrays.asList("com.example.target1"))
        .build();

appInteractionManager.createSession(createSessionParams, executor, callback);

Parameters
params AppInteractionSession.CreateParams: The params to create the session.
This value cannot be null.

executor Executor: The executor to run the callback on.
This value cannot be null.
Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

callback OutcomeReceiver: The callback to be called when the session is created or an error occurs.
This value cannot be null.