Android Question [SOLVED] InApp Purchases - Suddenly no price

hatzisn

Well-Known Member
Licensed User
Longtime User
Suddenly the p.Price in subscription does not have a value. (p = SkuDetails). Did this happen also to anyone else? Any solutions?
 

hatzisn

Well-Known Member
Licensed User
Longtime User
This is expected. SkuDetails.Price returns the formatted price for one time purchase offers only.

I do not understand. I am almost completely sure that I was seeing the price of the purchase of subscription even with the new GoogleBillingLibrary 5.00 from the same code. If this is the case, how can we get the price of the subscription?
 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
Is this done beggining with the last Log(.....) In this thread:

 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
Ok I have solved it. Here is the code:

B4X:
    For Each p As SkuDetails In Products
        ii=ii+1
'        Log(p.Sku)
'        Log(p.Title)
'        Log(p.Description)
'        Log("<--" & p.Price & "-->")
'        Log("================")
        Dim pnl As B4XView
        pnl = xui.CreatePanel("")
        pnl.Tag = ii
        pnl.SetLayoutAnimated(0, 0, 0, clv.AsView.Width, 150dip)
        pnl.Color = Colors.Transparent
     
        Dim sPrice As String
      
        If p.Price = "" Then 
            Dim offers As List = p.As(JavaObject).RunMethod("getSubscriptionOfferDetails", Null)
            Dim offer As JavaObject = offers.Get(0)
            Dim PricingPhases As JavaObject
            PricingPhases = offer.RunMethod("getPricingPhases", Null)
            Dim l As List = PricingPhases.RunMethod("getPricingPhaseList", Null)
            Dim PricingPhase As JavaObject
            PricingPhase = l.Get(0)
            sPrice = PricingPhase.RunMethod("getFormattedPrice", Null)
        Else
            sPrice = p.Price
        End If
      
        Log(sPrice)

     
        clv.Add(pnl, CreateCards(p.Sku, p.Title, p.Description, sPrice))
     
    Next
 
Last edited:
Upvote 0
Top