libgdx / gdx-pay

A libGDX cross-platform API for InApp purchasing.
Apache License 2.0
225 stars 82 forks source link

IAB helper setup is in progress. Can't perform operation: queryInventory #59

Closed Maktos closed 8 years ago

Maktos commented 8 years ago

09-15 20:16:57.952: E/OpenIAB(6040): Illegal state for operation (queryInventory): IAB helper setup is in progress. 09-15 20:16:57.952: W/dalvikvm(6040): threadid=14: thread exiting with uncaught exception (group=0x40c431f8) 09-15 20:16:57.962: E/AndroidRuntime(6040): FATAL EXCEPTION: GLThread 569 09-15 20:16:57.962: E/AndroidRuntime(6040): java.lang.IllegalStateException: IAB helper setup is in progress. Can't perform operation: queryInventory 09-15 20:16:57.962: E/AndroidRuntime(6040): at org.onepf.oms.OpenIabHelper.checkSetupDone(OpenIabHelper.java:1545) 09-15 20:16:57.962: E/AndroidRuntime(6040): at org.onepf.oms.OpenIabHelper.queryInventoryAsync(OpenIabHelper.java:1441) 09-15 20:16:57.962: E/AndroidRuntime(6040): at com.badlogic.gdx.pay.android.openiab.PurchaseManagerAndroidOpenIAB.purchaseRestore(PurchaseManagerAndroidOpenIAB.java:364) 09-15 20:16:57.962: E/AndroidRuntime(6040): at com.twosquidgames.ninesquids.handlers.PlatformResolver.requestPurchaseRestore(PlatformResolver.java:56) 09-15 20:16:57.962: E/AndroidRuntime(6040): at com.twosquidgames.ninesquids.NineSquids.create(NineSquids.java:1347)

noblemaster commented 8 years ago

Based on "Illegal state for operation (queryInventory): IAB helper setup is in progress." I'd say you are calling the purchase manager before "handleInstall" has returned. Please make sure that installation has completed before you call any of the purchase manager functions.

Maktos commented 8 years ago

How would I do this? I'm not actually calling "queryInventory" for example. That's done automatically by gdx-pay. How would I ask gdx-pay if it's done with handleInstall? I guess my point is that I'm not in full control, using a library that abstracts a lot of this.

noblemaster commented 8 years ago

You need to wait for handleInstall(...) to return (meaning install was successful). After that, you can do a purchase restore but not before! Also watch out if handleInstallError(...) was called meaning there was an error installing/registering the purchasing system!

tobloef commented 8 years ago

I have this problem as well and I can't seem to figure out how to fix it, as I'm not the one calling the code. I'm not sure where or how I should wait for handleInstall, as you said above.

noblemaster commented 8 years ago

You need to call:

PurchaseSystem.install(new PurchaseObserver() { ... }

Then wait for the PurchaseObserver's handleInstall to return (or the error condition!). You can't start any transaction etc. until handleInstall/handleInstallError has returned.

noblemaster commented 8 years ago

Is this resolved? Comments?

noblemaster commented 8 years ago

No response: assuming resolved.