Android 片段中 AutoResolveHelper.resolveTask 的替代方案是什么?
我正在尝试将 Google Pay 集成到我的应用程序中,一切似乎都很好,直到我必须解决 PaymentClient.loadPaymentData()
中的任务。它是从片段中调用的,据我所知,onActivityResult()
已被弃用,取而代之的是 registerForActivityResult()
。我似乎无法找到使用此功能解决任务的方法。我该怎么做?
对于代码参考,我遵循了本教程: https:// Developers.google.com/pay/api/android/guides/tutorial#checkoutactivity.kt-kotlin 并建议使用 AutoResolveHelper.resolveTask()
但它使用 onActivityResult()
来获取结果。
I am trying to integrate Google Pay into my application and all seems fine until I have to resolve the task from PaymentClient.loadPaymentData()
. It's being called from a fragment and as far as I know onActivityResult()
has been deprecated in favor of registerForActivityResult()
. I can't seem to find a way to resolve the task using this function. How do I do that?
For code reference I followed this tutorial: https://developers.google.com/pay/api/android/guides/tutorial#checkoutactivity.kt-kotlin and it recommends using AutoResolveHelper.resolveTask()
but it uses onActivityResult()
for its results.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Android 上的 Google Pay API 收到了更新,可以使用新的 Activity Result API(请参阅 更新了教程步骤)。借助此 API,您现在可以从 Fragments 启动支付便利。
the Google Pay API on Android received an update to use the new Activity Result API (see the updated tutorial step). With this API, you can now start payment facilitations from your Fragments.