hi
i am having a look at the inapp purchase example from erel here:
and if i open the example i have this 2 events:
i used this example for years but now something is not clear to me.
you call the event: HandleAdsPurchase(p) if p.Sku = ADS_SDK_ID
then in handle purchase you say:
but should not it be:
???
only if the name of the inapp product is the one you are checking has been purchased false then invalid purchase but if you ask if the name is false then it will already be false because you called the HandleAdsPurchase(p) after the name mached the inapp purchase here:
looks wrong to me, or am i missing something??
i am having a look at the inapp purchase example from erel here:
GooglePlayBilling - In App Purchases
The previous service which was used by InAppBilling3 library is being deprecated and will soon won't be available. GooglePlayBilling is based on the new in app purchases service: https://developer.android.com/google/play/billing/billing_library_overview Usage instructions: 1. Add to the...
www.b4x.com
and if i open the example i have this 2 events:
B4X:
Private Sub RestorePurchases
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)
Log("Query completed: " & Result.IsSuccess)
If Result.IsSuccess Then
For Each p As Purchase In Purchases
If p.Sku = ADS_SDK_ID Then HandleAdsPurchase(p)
Next
End If
End If
End Sub
B4X:
Private Sub HandleAdsPurchase (p As Purchase)
If p.PurchaseState <> p.STATE_PURCHASED Then Return
'Verify the purchase signature.
'This cannot be done with the test id.
If p.Sku.StartsWith("android.test") = False And billing.VerifyPurchase(p, BILLING_KEY) = False Then
Log("Invalid purchase")
Return
End If
If p.IsAcknowledged = False Then
'we either acknowledge the product or consume it.
Wait For (billing.AcknowledgePurchase(p.PurchaseToken, "")) Billing_AcknowledgeCompleted (Result As BillingResult)
Log("Acknowledged: " & Result.IsSuccess)
End If
AdsRemoved = True
Log("AdsRemoved")
UpdateAdsState
End Sub
i used this example for years but now something is not clear to me.
you call the event: HandleAdsPurchase(p) if p.Sku = ADS_SDK_ID
then in handle purchase you say:
B4X:
If p.Sku.StartsWith("android.test") = False And billing.VerifyPurchase(p, BILLING_KEY) = False Then
Log("Invalid purchase")
Return
End If
B4X:
If p.Sku.StartsWith("android.test") = True And billing.VerifyPurchase(p, BILLING_KEY) = False Then
Log("Invalid purchase")
Return
End If
???
only if the name of the inapp product is the one you are checking has been purchased false then invalid purchase but if you ask if the name is false then it will already be false because you called the HandleAdsPurchase(p) after the name mached the inapp purchase here:
B4X:
If p.Sku = ADS_SDK_ID Then HandleAdsPurchase(p)
looks wrong to me, or am i missing something??