Sub Process_Globals
Dim billman3 As BillingManager3
Dim Const key As String = "MIIBIjANBgkqhkB..."
Dim DeveloperPayload As String = "My App"
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
billman3.Initialize("billman3", key)
billman3.DebugLogging = False
End If
...
End Sub
'* * * IN-APP BILLING
Sub billman3_BillingSupported (Supported As Boolean, Message As String)
If Supported Then
billman3.GetOwnedProducts
End If
End Sub
Sub billman3_OwnedProducts (Success As Boolean, purchases As Map)
Log("Success: " & Success)
If Success Then
' success = true and have purchases
If purchases.Size > 0 Then
Log("purchases.Size > 0")
For Each p As Purchase In purchases.Values
Log(p.PurchaseState) '0 - purchased, 1 - canceled, 2 - refunded.
If p.ProductId = "hide_ad" Then
If p.PurchaseState = p.STATE_PURCHASED Then
Utils.FullVersion = True
GetFull
End If
End If
Next
Else
' success = true and don't have purchases
Utils.FullVersion = False
GetFreeVersion
End If
Else
' success = false
Utils.FullVersion = False
GetFreeVersion
End If
End Sub
Sub billman3_PurchaseCompleted(Success As Boolean, Product As Purchase)
If Success Then
If Product.Productid = "hide_ad" Then
Msgbox("Advertisements will not run.","Hide Ads")
ConfirmPayment
End If
End If
End Sub
Sub ConfirmPayment
Utils.FullVersion = True
'hide admob
If AdView1.IsInitialized Then
AdView1.Visible = False
AdView1.Enabled = False
End If
'reduce advertisements space
iheight = 5dip
'adjust main panel
pContent.Height = Activity.height - (pnlAB.height + iheight)
'adjust grid
Grid.Height = pContent.Height
End Sub
Sub GetFull
Utils.FullVersion = True
iheight = 5dip
'reduce advertisements space
iheight = 5dip
'adjust main panel
pContent.Height = Activity.height - (pnlAB.height + iheight)
End Sub
Sub GetFreeVersion
Utils.FullVersion = False
iheight = 50dip
Activity.AddView(pContent, 0, pnlAB.height, Activity.Width, Activity.height-(pnlAB.height + iheight))
...
'show ads
Activity.AddView(AdView1, 0dip, 100%y - (iheight - 3dip), 100%x, iheight)
AdView1.LoadAd 'loads an ad
End Sub
'END IN-APP * * * * * * * * * *