gpt4 book ai didi

android - 为结果启动 PendingIntent

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:39:07 26 4
gpt4 key购买 nike

我实现了 Activity X。我从 Service S 得到了一个 PendingIntent P。我确定 P 指向 unknown Activity Y,它通过其 setResult 方法返回结果 R。

我应该如何在 X 中启动 P,以便在 X.onActivityResult 中接收结果 R?

最佳答案

Google Play 服务使用 PendingIntent 对象来解决同一场景中的权限错误:

IntentSender intentSender = pendingIntent.getIntentSender();
activity.startIntentSenderForResult(intentSender, REQUEST_CODE, null, 0, 0, 0);

参见 Activity.startIntentSenderForResult()用于文档。

关于android - 为结果启动 PendingIntent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10362525/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com