Hello, I'm displaying an InterstitialAd on the B4Xpages main page. When the ad is clicked, it redirects to the ad page, but when I click on the close button, nothing happens. It doesn't close the ad.
The following Google warning appears on the log screen. I'm using it for the first time, and I don't have any knowledge. What should I do?
B4X:
<Google> Status bar could not be hidden for full-screen ad. Ensure that your app is configured to allow full-screen ads to control the status bar. For example, consider whether you need to set the childViewControllerForStatusBarHidden property on your ad's rootViewController.
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private iad As InterstitialAd
End Sub
Public Sub Initialize
' B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
iad.Initialize("iad", "ca-app-pub-3940256099942544/4411468910")
End Sub
Private Sub Button1_Click
iad.RequestAd
End Sub
Sub iad_Ready (Success As Boolean)
If Success Then
Log("iad is ready.")
iad.Show(B4XPages.GetNativeParent(Me))
Else
Log("Failed to load full screen ad: " & LastException)
End If
End Sub
Sub iAd_Closed
Log("closed")
End Sub
Private Sub iad_AdClosed
Log("adclosed")
End Sub
Private Sub iad_AdOpened
Log("iad opened")
End Sub
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private iad As InterstitialAd
End Sub
Public Sub Initialize
' B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
iad.Initialize("iad", "ca-app-pub-3940256099942544/4411468910")
End Sub
Private Sub Button1_Click
iad.RequestAd
End Sub
Sub iad_Ready (Success As Boolean)
If Success Then
Log("iad is ready.")
iad.Show(B4XPages.GetNativeParent(Me))
Else
Log("Failed to load full screen ad: " & LastException)
End If
End Sub
Sub iAd_Closed
Log("closed")
End Sub
Private Sub iad_AdClosed
Log("adclosed")
End Sub
Private Sub iad_AdOpened
Log("iad opened")
End Sub
Correct. It's working when the close button is in the middle of the screen. It doesn't work when the close button is in the top right corner.
Please check the attachment.
I thought it was about SafeArea because it seems ad is shown not in the safe area
B4X:
Private Sub B4XPage_Resize (Width As Float, Height As Float)
#if B4i
Dim r As Rect = B4XPages.GetNativeParent(Me).SafeAreaInsets
Root.SetLayoutAnimated(0, r.Left, r.Top, Width - r.Right - r.Left, Height - r.Bottom - r.Top)
#end if
End Sub
Hello. I ran the same code you wrote.(b4xsample project) I am not hiding the status bar. The IsStatusBarHidden function returns a false value. I am receiving the following message in the log console.
B4X:
<Google> Status bar could not be hidden for full screen ad. Ensure that your app is configured to allow full screen ads to control the status bar. For example, consider whether you need to set the childViewControllerForStatusBarHidden property on your ad's rootViewController.