Closed wsrdzg closed 9 years ago
From the looks of it, it should be implemented (via OpenIAB backend). What problem are you having exactly?
I call PurchaseSystem.getInformation(...) in handleInstall() and later but I always get an Information object that returns null for getLocalPricing(), getLocalDescription() and getLocalName(). I use 0.4.0 because the snapshot version seems to be not available.
0.4.0 is the correct version. Here is the code that returns the information object: https://github.com/libgdx/gdx-pay/blob/master/gdx-pay-android-openiab/src/com/badlogic/gdx/pay/android/openiab/PurchaseManagerAndroidOpenIAB.java#L393
I haven't tested it myself, but it should work as long as your purchase is registered in Google Play. I assume you have set it up and made sure the identifier matches with the identifier in Google Play?
In your log output, do you see anything that might indicate a problem?
I can purchase the In-App-Products so everything should be configured correctly.
04-07 19:11:12.534 9806-9887/? D/GdxPay/IAP﹕ Failed to locate purchase manager for OUYA-IAP (gdx-pay-android-ouya.jar file not installed)
java.lang.ClassNotFoundException: com.badlogic.gdx.pay.android.ouya.PurchaseManagerAndroidOUYA
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:308)
at java.lang.Class.forName(Class.java:272)
at com.badlogic.gdx.pay.android.IAP.<init>(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at com.badlogic.gdx.pay.g.a(Unknown Source)
at com.badlogic.gdx.pay.g.b(Unknown Source)
at com.example.game.w.run(Unknown Source)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.badlogic.gdx.pay.android.ouya.PurchaseManagerAndroidOUYA" on path: DexPathList[[zip file "/data/app/com.example.game-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.game-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:308)
at java.lang.Class.forName(Class.java:272)
at com.badlogic.gdx.pay.android.IAP.<init>(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at com.badlogic.gdx.pay.g.a(Unknown Source)
at com.badlogic.gdx.pay.g.b(Unknown Source)
at com.example.game.w.run(Unknown Source)
at java.lang.Thread.run(Thread.java:818)
Suppressed: java.lang.ClassNotFoundException: com.badlogic.gdx.pay.android.ouya.PurchaseManagerAndroidOUYA
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 11 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
04-07 19:11:12.535 9806-9887/? I/IAP﹕ IAP: gdx-pay successfully instantiated.
04-07 19:11:12.869 7401-7422/? D/Finsky﹕ [480] InAppBillingUtils.getPreferredAccount: com.example.game: Account from first account - [3Dzr58HtvfD7G6vFdfggvFvggvf]
04-07 19:11:12.880 7401-7422/? D/Finsky﹕ [480] InAppBillingUtils.getPreferredAccount: com.example.game: Account from first account - [3Dzr58HtvfD7G6vFdfggvFvggvf]
04-07 19:11:12.881 7401-7421/? D/Finsky﹕ [479] InAppBillingUtils.getPreferredAccount: com.example.game: Account from first account - [3Dzr58HtvfD7G6vFdfggvFvggvf]
04-07 19:11:12.888 7401-7448/? D/Finsky﹕ [499] InAppBillingUtils.getPreferredAccount: com.example.game: Account from first account - [3Dzr58HtvfD7G6vFdfggvFvggvf]
04-07 19:11:12.891 7401-7422/? D/Finsky﹕ [480] InAppBillingUtils.getPreferredAccount: com.example.game: Account from first account - [3Dzr58HtvfD7G6vFdfggvFvggvf]
04-07 19:11:12.892 9806-9806/? E/a﹕ information: null null null
04-07 19:11:12.895 7401-7421/? D/Finsky﹕ [479] InAppBillingUtils.getPreferredAccount: com.example.game: Account from first account - [3Dzr58HtvfD7G6vFdfggvFvggvf]
04-07 19:11:12.897 7401-7448/? D/Finsky﹕ [499] InAppBillingUtils.getPreferredAccount: com.example.game: Account from first account - [3Dzr58HtvfD7G6vFdfggvFvggvf]
Looks fine to me. It's possible that OpenIAB didn't instantiate the purchase manager for Google Play but something else, e.g. "Amazon". Can do a system out for for PurchaseSystem.getManager().toString() and see if you are actually on Google Play?
PurchaseSystem.getManager().toString()
returns OpenIAB/com.google.play
PurchaseSystem.getInformation("0")
returns Information.UNAVAILABLE
Looks correct. And yes, "Information.UNAVAILABLE" is returned if the identifier wasn't found. So the identifier you are usually enter exists exactly as you manually defined in your Google Play Dashboard?
Yes, I'm using the same String to buy the item and it works.
Mhh, I am little bit out of options. Is it possible although you are using 0.4.0 that you still have some older cached JARs somewhere that might break things? Maybe not your fault but your development environment is using older SNAPSHOTs but not 0.4.0 RELEASE?
In any case, I uploaded 0.5.0-SNAPSHOT. Can you try that. That's exactly the same as 0.4.0 RELEASE. Let's hope that works :)
hi, where can i get 0.5.0-SNAPSHOT jar for eclipse?
Eclipse? You just update Maven to the SNAPSHOT repository.
Same with 0.5.0-SNAPSHOT
Not sure what to advice otherwise? It seems to work to at least the guy that implemented it. From the looks of it it seems fine to me. I haven't tested it personally though as it's a feature that is not supported by all payment providers. Could you have a closer look to find what is wrong with it?
I have the same issue. The method will only work after the product (OfferType.ENTITLEMENT) has been purchased.
Before purchasing: PurchaseSystem.getInformation("identifier") == Information.UNAVAILABLE After purchasing: PurchaseSystem.getInformation("identifier") == it's OK
@leni8ec right. @noblemaster OpenIabHelper.queryInventoryAsync(querySkuDetails, IabHelper.QueryInventoryFinishedListener listener) // fills inventory only for the items that are already purchased by the user. To load information about all inapps and subscription it is required to use another overloaded version of the method. Like: OpenIabHelper.queryInventoryAsync(querySkuDetails, moreItemSkus, moreSubsSkus, IabHelper.QueryInventoryFinishedListener listener)
Added - Thanks :-D
Is getInformation implemented for Google play yet? I looked at the code but wasn't sure and couldn't get it work on my device. I really need this to provide In-App-Purchase only in selected countries.