AppInteractionManager.CreateSession Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates an app interaction session for the given params.
[Android.Runtime.Register("createSession", "(Landroid/app/AppInteractionSession$CreateParams;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "", ApiSince=37)]
public void CreateSession(Android.App.AppInteractionSession.CreateParams params, Java.Util.Concurrent.IExecutor executor, Android.OS.IOutcomeReceiver callback);
[<Android.Runtime.Register("createSession", "(Landroid/app/AppInteractionSession$CreateParams;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "", ApiSince=37)>]
member this.CreateSession : Android.App.AppInteractionSession.CreateParams * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit
Parameters
The params to create the session. This value cannot be null.
- executor
- IExecutor
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
- IOutcomeReceiver
The callback to be called when the session is created or an error occurs. This value cannot be null.
- Attributes
Remarks
Creates an app interaction session for the given params.
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);
Android reference for android.app.AppInteractionManager.createSession.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.