hi, i have a question to the new google billing method from here: https://www.b4x.com/android/forum/threads/googleplaybilling-in-app-purchases.109945/
so i have downloaded the example and i try to understand but it is unclear to me.
there is a removeAds button and a resetAds button
the resetAds event looks like this:
so it says we want to get the ads product and consume it so i understand the purchase is made here but why is AdsRemoved set to False?
if it is False than ADS will be shown, right (lblAd.Visible = Not(AdsRemoved)) ?
and if we make the purchase in the ResetAds button than what do we do in the btnRemoveAds event?
i am really confused
so i have downloaded the example and i try to understand but it is unclear to me.
there is a removeAds button and a resetAds button
the resetAds event looks like this:
B4X:
Public Sub ResetAds
'we want to get the ads product and consume it
Wait For (billing.ConnectIfNeeded) Billing_Connected (Result As BillingResult)
If Result.IsSuccess Then
Wait For (billing.QueryPurchases("inapp")) Billing_PurchasesQueryCompleted (Result As BillingResult, Purchases As List)
If Result.IsSuccess Then
ConsumeAdsProduct(Purchases)
End If
End If
End Sub
Private Sub ConsumeAdsProduct(Purchases As List)
For Each p As Purchase In Purchases
If p.Sku = ADS_SDK_ID Then
Wait For (billing.Consume(p.PurchaseToken, "")) Billing_ConsumeCompleted (Result As BillingResult)
If Result.IsSuccess Then
Log("consumed")
AdsRemoved = False
UpdateAdsState
End If
End If
Next
End Sub
so it says we want to get the ads product and consume it so i understand the purchase is made here but why is AdsRemoved set to False?
if it is False than ADS will be shown, right (lblAd.Visible = Not(AdsRemoved)) ?
B4X:
Private Sub UpdateAdsState
lblAd.Visible = Not(AdsRemoved)
btnRemoveAds.Enabled = Not(AdsRemoved)
btnReset.Enabled = AdsRemoved
End Sub
and if we make the purchase in the ResetAds button than what do we do in the btnRemoveAds event?
B4X:
Sub btnRemoveAds_Click
'make sure that the store service is connected
Wait For (billing.ConnectIfNeeded) Billing_Connected (Result As BillingResult)
If Result.IsSuccess Then
'get the sku details
Dim sf As Object = billing.QuerySkuDetails("inapp", Array(ADS_SDK_ID))
Wait For (sf) Billing_SkuQueryCompleted (Result As BillingResult, SkuDetails As List)
If Result.IsSuccess And SkuDetails.Size = 1 Then
Result = billing.LaunchBillingFlow(SkuDetails.Get(0))
If Result.IsSuccess Then Return
End If
End If
ToastMessageShow("Error starting billing process", True)
End Sub
i am really confused