AppInteractionManager.CreateSession 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为给定参数创建应用交互会话。
[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
参数
用于创建会话的参数。 此值不能为 null。
- executor
- IExecutor
要运行回调的执行程序。 此值不能为 null。 回调和侦听器事件通过此执行程序调度,提供一种控制使用哪个线程的简单方法。 若要通过应用程序的主线程调度事件,可以使用 Context.getMainExecutor()。 否则,请提供调度到相应线程的执行程序。
- callback
- IOutcomeReceiver
创建会话或发生错误时要调用的回调。 此值不能为 null。
- 特性
注解
为给定参数创建应用交互会话。
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 参考。android.app.AppInteractionManager.createSession
本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。