Android Question [solved] GooglePlayBilling v7.00 - subscription error

aeric

Expert
Licensed User
Longtime User
I am testing the new GooglePlayBilling library v7.00

I get an error on line #99 when calling LaunchBillingFlow for subscriptions.
B4X:
Result = billing.LaunchBillingFlow(SkuDetails.Get(0))

SkuDetails.Get(0) has value:

ProductDetails{jsonString='{"productId":"weekly_1","type":"subs","title":"Weekly RM1.99 (In App Billing Demo)","name":"Weekly RM1.99","description":"Weekly Subscription for RM1.99 only","localizedIn":["en-US"],"skuDetailsToken":"AEuhp4JcTcV5...","subscriptionOfferDetails":[{"offerIdToken":"AZbOM32R2\/CPjBmc...==","basePlanId":"p1w","pricingPhases":[{"priceAmountMicros":1990000,"priceCurrencyCode":"MYR","formattedPrice":"RM 1.99","billingPeriod":"P1W","recurrenceMode":1}],"offerTags":[]}]}', parsedJson={"productId":"weekly_1","type":"subs","title":"Weekly RM1.99 (In App Billing Demo)","name":"Weekly RM1.99","description":"Weekly Subscription for RM1.99 only","localizedIn":["en-US"],"skuDetailsToken":"AEuhp4JcTcV5...=","subscriptionOfferDetails":[{"offerIdToken":"AZbOM32R2\/CPjBmc...==","basePlanId":"p1w","pricingPhases":[{"priceAmountMicros":1990000,"priceCurrencyCode":"MYR","formattedPrice":"RM 1.99","billingPeriod":"P1W","recurrenceMode":1}],"offerTags":[]}]}, productId='weekly_1', productType='subs', title='Weekly RM1.99 (In App Billing Demo)', productDetailsToken='AEuhp4JcTcV5...=', subscriptionOfferDetails=[com.android.billingclient.api.ProductDetails$SubscriptionOfferDetails@f93a1b]}

Error logs:
 
Solution
Solved.

B4X:
'Result = LaunchBillingFlow(billing, SkuDetails.Get(0), "")
Dim offers As List = SkuDetails.Get(0).As(JavaObject).RunMethod("getSubscriptionOfferDetails", Null)
Dim offer As JavaObject = offers.Get(0)
Dim OfferToken As String = offer.RunMethod("getOfferToken", Null)
Result = LaunchBillingFlow(billing, SkuDetails.Get(0), OfferToken)

aeric

Expert
Licensed User
Longtime User
Solved.

B4X:
'Result = LaunchBillingFlow(billing, SkuDetails.Get(0), "")
Dim offers As List = SkuDetails.Get(0).As(JavaObject).RunMethod("getSubscriptionOfferDetails", Null)
Dim offer As JavaObject = offers.Get(0)
Dim OfferToken As String = offer.RunMethod("getOfferToken", Null)
Result = LaunchBillingFlow(billing, SkuDetails.Get(0), OfferToken)

 
Upvote 1
Solution

giggetto71

Active Member
Licensed User
Longtime User
HI @aeric .Where did you find the version 7 of the GooglePlayBilling library? from the ide I can see that the latest available is 5.21. as all the developers I got the notification from google to update to the 6 or newer by Aug. 31th 2024..
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
HI @aeric .Where did you find the version 7 of the GooglePlayBilling library? from the ide I can see that the latest available is 5.21. as all the developers I got the notification from google to update to the 6 or newer by Aug. 31th 2024..
Check attached library by Erel in post #3.
 
Upvote 0

Jim McDougal

Member
Licensed User
Is GooglePlayBilling v7 an internal library? I'm running B4A 12.80 but the Libraries Manager is showing GooglePlayBilling as v5. I also placed the separate jar files for v7 in my Additional Libraries folder but still nothing shows except GooglePlayBilling v5 in Libraries Manager.
 
Upvote 0

Scantech

Well-Known Member
Licensed User
Longtime User
i placed mine at C:\Program Files\Anywhere Software\B4A\Libraries. Its internal library
 
Upvote 0

Jim McDougal

Member
Licensed User
I didn't see v7.00 in the libraries tab after upgrading to 12.80 (it was still v5.00) so I followed Scantech's advice, manually replacing v5.00 with v7.00 in the internal libraries folder and now the libraries tab shows v7.00. I was assuming that since it is an internal library it would upgrade to v7.00 with the latest B4A upgrade, but apparently not. Nevertheless, question resolved. Thank you, all.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
All the while it works like that.
When a new internal library is released after the latest version of B4A released, we need to copy it to internal library folder. We don't reinstall B4A.
The message saying that it is an internal library denotes that the correct way is to copy the library to internal library which is inside B4A installation folder instead of additional library folder, to avoid it is not loading as you did. It also means that it will available in the next release of B4A if there is no newer version of this library released until then. Hope this answers your doubt.
 
Upvote 0

Jim McDougal

Member
Licensed User
A classic timing issue. Makes perfect sense. I did upgrade to the latest version of B4A as a result anyway, so it's all good.

Thanks!
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User

Thank you very much. Great solution. It solved a lot for me.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…