Public Sub GetAllProductPrice
'************* GOOGLE PLAY STORE ******************
'make sure that the store service is connected
Starter.myLog.Add($"(GetAllProductPrice) Getting Prices from PS"$)
Wait For (Starter.billing.ConnectIfNeeded) Billing_Connected (Result As BillingResult)
If Result.IsSuccess Then
'get the sku details
Starter.myLog.Add($"(GetAllProductPrice) Connected to PS Result - ${Result.ResponseCodeString}"$)
Dim sf As Object = Starter.billing.QuerySkuDetails("subs", Array(Starter.ADS_SDK_ID4,Starter.ADS_SDK_ID5))
Wait For (sf) Billing_SkuQueryCompleted (Result As BillingResult, SkuDetailsList As List)
Starter.myLog.Add($"(GetAllProductPrice) Info received from PS Result - ${Result.ResponseCodeString}"$)
If Result.IsSuccess And SkuDetailsList.Size > 0 Then
clvSubscribe.Clear
For Each Sku As SkuDetails In SkuDetailsList
Dim sPrice As String
If Sku.Price = "" Then
Dim offers As List = Sku.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 = Sku.Price
End If
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, clvSubscribe.AsView.Width, 200dip)
p.LoadLayout("subsrowlayout")
Dim mydesc As String = ""
If Sku.Sku = "lara202312" Then
clvSubsItemTitle.Text = B4XPages.MainPage.loc.Localize("LARA 12 Month Subscription")
mydesc = Sku.Description & CRLF & CRLF & "Free Trial - Cancel subscription withing 7 days and there will be no charge"
End If
If Sku.Sku = "lara202306" Then
clvSubsItemTitle.Text = B4XPages.MainPage.loc.Localize("LARA 6 Month Subscription")
mydesc = Sku.Description & CRLF & CRLF & "Free Trial - Cancel subscription withing 7 days and there will be no charge"
End If
If Starter.SKU_Purchased = Sku.Sku Then
clvSubsItemAmount.Text = B4XPages.MainPage.loc.Localize("Active")
clvSubsItemButton.Text = B4XPages.MainPage.loc.Localize("Cancel")
mydesc = Sku.Description & CRLF & CRLF & Starter.productID & CRLF & DateTime.Date(Starter.purchaseTime) & " - " & DateTime.Time(Starter.purchaseTime)
Else
clvSubsItemAmount.Text = sPrice
clvSubsItemButton.Text = B4XPages.MainPage.loc.Localize("Buy")
If Main.AppSubscriptionActive = True Then
clvSubsItemButton.Enabled = False
End If
End If
clvSubsItemDesc.Text = mydesc
clvSubscribe.Add(p,Sku.Title)
Next
clvSubscribe.AsView.Visible = True
else if Result.ResponseCodeString = "FEATURE_NOT_SUPPORTED" Then
xui.MsgboxAsync($"Sorry your version of Google Play Store is not supported${CRLF}Result - ${Result.ResponseCodeString}"$, "Not Supported")
End If
Else
xui.MsgboxAsync($"Unable to connect to Google Billing to check Subscription${CRLF}Check internet access${CRLF}Result - ${Result.ResponseCodeString}"$, "Can't Connect")
End If
End Sub