Android Question GooglePlayBilling v8.00

Alessandro71

Well-Known Member
Licensed User
Longtime User
No longer beta. I can help you implement the in-app messaging feature using JavaObject. You will need to test it.
i see the library manager now lists 8.00 as online version
is there any code changes required from our side when updating from the old 7.02 to 8.00, or it's just a version number bump?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
@Jerryk here is a first implementation of this API:
1. Add to main module:
B4X:
#AdditionalJar: androidx.core:core

2.
B4X:
Private Sub ShowInAppMessages
    Wait For (billing.ConnectIfNeeded) Billing_Connected (Result As BillingResult)
    Dim client As JavaObject = billing.As(JavaObject).GetField("client")
    Dim ParamsBuilder As JavaObject
    ParamsBuilder.InitializeNewInstance("com.android.billingclient.api.InAppMessageParams$Builder", Null)
    ParamsBuilder.RunMethod("addAllInAppMessageCategoriesToShow", Null)
    Dim Params As JavaObject = ParamsBuilder.RunMethod("build", Null)
    Dim Listener As Object = client.CreateEventFromUI("com.android.billingclient.api.InAppMessageResponseListener", _
        "InAppMessage", Null)
    Dim ctxt As JavaObject
    ctxt.InitializeContext
    client.RunMethod("showInAppMessages", Array(ctxt, Params, Listener))
    Wait For InAppMessage_Event (MethodName As String, Args() As Object)
    Log(MethodName)
    Dim Result2 As JavaObject = Args(0)
    Dim ResponseCode As Int = Result2.RunMethod("getResponseCode", Null)
    
    'https://developer.android.com/reference/com/android/billingclient/api/InAppMessageResult.InAppMessageResponseCode
    If ResponseCode = 0 Then 
        Log("No Action needed")
    Else
        Log("Subscription status updated")
    End If
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…