Android Question [Solved] GetInventoryInformation and GooglePlayBilling

asales

Expert
Licensed User
Longtime User
In In-App Billing v3 library I have this method "GetInventoryInformation" an I can get the information the price using this code:
B4X:
Sub billman3_InventoryCompleted (Success As Boolean, Products As List)
    If Success Then
        For Each sk As SkuDetails In Products
            Dim parser As JSONParser
            Dim s As String = sk.toString
            Dim i As Int = s.IndexOf(":")
            s = s.Substring(i + 1)
            parser.Initialize(s)
            Dim root As Map = parser.NextObject
            price = root.Get("price")
        Next
    End If
End Sub

How I can do this using the new library GooglePlayBilling?

Thanks in advance for any tip.
 

asales

Expert
Licensed User
Longtime User
Yes. It returns a JSON inside a list, like this:
B4X:
(ArrayList) [SkuDetails: {"skuDetailsToken":"A128B7_8cMADCJfvt_5uKKhiillfkK2us_H5S8sdkJKHKKLL3QHF","productId":"remove_ads","type":"inapp","price":"R$ 2,99","price_amount_micros":2990000,"price_currency_code":"BRL","title":"Remover anúncios","description":"Remove anúncios."}]
but I don't know how I can extract the JSON from this list and parse it.
Thanks.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Thanks. It works. Only change this lines:
B4X:
Dim sku As SkuDetails = SkuDetails.Get(0)
Log(sku.Price)
 
Last edited:
Upvote 0
Top