我在使用 Google 提供的 IABHelper 的 In App Billing Version 3 时遇到间歇性问题。
在启动新购买之前,我使用 queryInventoryAsync 检查未消费的购买。如果发现我消费任何未消费的购买并开始新的交易,如果没有直接开始新的交易。99% 的时间它都能正常工作。
有时,当 queryInventoryAsync 没有返回未消费的购买时,以下 launchPurchaseFlow 会失败并显示响应:7:项目已拥有。
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 版本。