Sub Process_Globals
Dim manager As BillingManager3
Dim Const key As String = "MIIBIjANBgkqhkiG9w0BAQEFAA..."
Dim DeveloperPayload As String = "My App"
End Sub
Sub Globals
Private Button1 As Button
Private pnlAdMob As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout1")
If FirstTime Then
manager.Initialize("manager", key)
End If
manager.DebugLogging = True
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
'* * * IN-APP BILLING
Sub manager_BillingSupported (Supported As Boolean, Message As String)
Log("SUPPORTED / MESSAGE: " & Supported & ", " & Message)
Log("Subscriptions supported: " & manager.SubscriptionsSupported)
If Supported Then
manager.GetOwnedProducts
End If
End Sub
Sub manager_OwnedProducts (Success As Boolean, purchases As Map)
Log("SUCCESS: " & Success)
If Success Then
Log("PURCHASES: " & purchases)
For Each p As Purchase In purchases.Values
If p.ProductId = "remove_ads" Then
If p.PurchaseState = p.STATE_PURCHASED Then
Log("STATE_PURCHASED")
pnlAdMob.Visible = False
Else If p.PurchaseState = p.STATE_CANCELED Or p.PurchaseState = p.STATE_REFUNDED Then
pnlAdMob.Visible = True
End If
End If
Next
End If
End Sub
Sub manager_PurchaseCompleted(Success As Boolean, Product As Purchase)
If Success Then
Log("You purchased " & Product.ProductId)
manager.ConsumeProduct(Product)
If Product.Productid = "remove_admob" Then
Msgbox("Remove AdMob","In-App Purchase")
End If
End If
End Sub
Sub Button1_Click
manager.RequestPayment("remove_admob", "inapp", DeveloperPayload)
End Sub