我在使用谷歌提供的iabhelper的应用程序内计费版本3中遇到了间歇性问题。
在启动新的采购之前,我使用queryinventoryasync检查未使用的采购。如果发现我消费了任何未使用的购买并开始一个新的交易,如果不是直接去开始一个新的交易。99%的时间工作正常。
有时,当queryinventoryasync返回no unconsumed purchaseflow时,以下launchpurchaseflow会失败,并给出响应:7:item already owned。

INFO    [IABHelper] Starting async operation: refresh inventory
INFO    [IABHelper] Querying owned items, item type: inapp
INFO    [IABHelper] Package name: jp.co.mycompany.myapp
INFO    [IABHelper] Calling getPurchases with continuation token: null
INFO    [IABHelper] Owned items response: 0
INFO    [IABHelper] Continuation token: null
INFO    [IABHelper] Querying SKU details.
INFO    [IABHelper] queryPrices: nothing to do because there are no SKUs.
INFO    [IABHelper] Querying owned items, item type: subs
INFO    [IABHelper] Package name: jp.co.mycompany.myapp
INFO    [IABHelper] Calling getPurchases with continuation token: null
INFO    [IABHelper] Owned items response: 0
INFO    [IABHelper] Continuation token: null
INFO    [IABHelper] Querying SKU details.
INFO    [IABHelper] queryPrices: nothing to do because there are no SKUs.
INFO    [IABHelper] Ending async operation: refresh inventory

INFO    [IABHelper] Constructing buy intent for jp.co.mycompany.myapp.myitem, item type: inapp
INFO    [IABHelper] Launching buy intent for jp.co.mycompany.myapp.myitem Request code: 1001
INFO    [IABHelper] Ending async operation: launchPurchaseFlow
INFO    [IABHelper] Purchase canceled - Response: 7:Item Already Owned

queryinventoryasync表示用户不拥有该项,但launchpurchaseflow表示用户拥有该项。
奇怪的是,经过一段时间(有时几分钟,有时更多),问题自行解决。
有人经历过类似的事情吗?
作为参考,我使用的是3月15日更新的iabhelper版本。

最佳答案

在手机上清除google play服务应用的缓存。它可能对你有用。

07-24 09:23