In-App Billing switching activities

佐手、 提交于 2019-12-12 10:14:01

问题


Ahh the in-app billing problems never end! ^.^ I have everything working properly to show the transaction page for the in-app purchase. If I complete the purchase it returns me to my application and after about 10 seconds it verifies the purchase and I receive the item.

On the other hand, if I press the back button after returning to the application and switch to another activity it never processes the transaction. Even if I return to the in-app billing activity I never receive my purchased item, like the purchase has been completely forgotten about if you call finish().

What can I do so that it either completes the transaction and gives the item when I return to the in-app billing activity or processes the transaction and gives the purchased item anywhere that I am at within my application?


回答1:


Receiving the notification is handled by a broadcast receiver which is independent from your activities. How you handle the notification is up to you. In the default implementation you have a PurchaseObserver interface implemented by an Activity. You can have multiple activities implement it and register to be called accordingly. Or, you can have related code in a base activity, so that all your activities are PurchaseObserver's (might not be practical if you have a lot of activities).



来源:https://stackoverflow.com/questions/11076038/in-app-billing-switching-activities

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!