Sub ConsentStateAvailable
Dim consent As ConsentManager = Starter.consent
If consent.ConsentState = consent.STATE_UNKNOWN Then ''And consent.IsRequestLocationInEeaOrUnknown
Dim stu As StringUtils
Dim dialog1 As CustomLayoutDialog
Dim sf As Object = dialog1.ShowAsync("", "OK", "", "", Null, False)
Wait For (sf) Dialog_Ready (DialogPanel As Panel)
DialogPanel.LoadLayout("frmAdmobConsens")
lblAppName.Text = Application.LabelName
lblInfo1.Text = "This is a Free App and contains ads in order to support the development."
lblInfo2.Text = "Do we have your permission to continue displaying ads?"
lblInfo3.Text = "Please make a Selection for " & Application.LabelName & " You can always change your selection in the App Settings"
lblInfo1.Height = stu.MeasureMultilineTextHeight(lblInfo1, lblInfo1.Text) + 10dip
lblInfo2.Height = stu.MeasureMultilineTextHeight(lblInfo2, lblInfo2.Text) + 10dip
lblInfo3.Height = stu.MeasureMultilineTextHeight(lblInfo3, lblInfo3.Text) + 10dip
lblInfo2.Top = lblInfo1.Top + lblInfo1.Height
lblInfo3.Top = lblInfo2.Top + lblInfo2.Height
RadioButton1.Top = lblInfo3.Top + lblInfo3.Height
RadioButton2.Top = RadioButton1.Top + RadioButton1.Height
RadioButton3.Top = RadioButton2.Top + RadioButton2.Height
RadioButton1.Text = "Yes, Continue with personalized Ads"
RadioButton2.Text = "No, I do not want to see personalized Ads"
RadioButton3.Text = "No, I do not want to see any Ads."
pnlAdmobConsens.Height = 10dip + lblAppName.Height + lblInfo1.Height + lblInfo2.Height + lblInfo3.Height + RadioButton1.Height + RadioButton2.Height + RadioButton3.Height
dialog1.SetSize(100%x, 80dip + pnlAdmobConsens.Height)
Wait For (sf) Dialog_Result (Result As Int)
If RadioButton1.Checked Then
consent.ConsentState = consent.STATE_PERSONALIZED
else if RadioButton2.Checked Then
consent.ConsentState = consent.STATE_NON_PERSONALIZED
else if RadioButton3.Checked Then
consent.ConsentState = consent.STATE_UNKNOWN
ExitApplication
End If
'LogColor($"Consent form result: ${consent.ConsentState}"$, Colors.Red)
End If
LoadAd
End Sub
Sub LoadAd
Dim builder As AdRequestBuilder
builder.Initialize
Dim consent As ConsentManager = Starter.consent
If consent.IsRequestLocationInEeaOrUnknown Then
If consent.ConsentState = consent.STATE_NON_PERSONALIZED Then
builder.NonPersonalizedAds
Else if consent.ConsentState = consent.STATE_UNKNOWN Then
Return
End If
End If
''builder.AddTestDevice("865BF86C54272BFD5EF122E568DC36F2")
admob.LoadAdWithBuilder(builder)
End Sub