Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IABHelper. queryInventoryAsync returns no purchases, yet launch product flow fails with "Item Already Owned"

I'm experiencing an intermittent problem with In App Billing Version 3 using IABHelper as provided by Google.

Before Launching a new purchase I check for unconsumed purchases with queryInventoryAsync. If found I consume any unconsumed purchases and begin a new transaction, if not go directly to start a new transaction. 99% of the time it works fine.

Occasionally when queryInventoryAsync returns no unconsumed purchases, the following launchPurchaseFlow fails with Response : 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 is saying the user does not own the item, but launchPurchaseFlow says the user does.

Strangely after a wait (sometimes a few minutes, sometimes more) the problem resolves itself.

Has anyone experienced anything similar?

For reference I'm using the version of IABHelper last updated on March 15.

like image 311
Byron Avatar asked Mar 21 '13 08:03

Byron


1 Answers

Do clear cache of Google Play Service app in mobile. It may work for you.

like image 98
Hafiz Waleed Hussain Avatar answered Oct 14 '22 20:10

Hafiz Waleed Hussain