Y ykucuk Well-Known Member Licensed User Longtime User Jun 14, 2023 #1 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? Code: <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. Can you help me with this issue, please?
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? Code: <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. Can you help me with this issue, please?
Erel B4X founder Staff member Licensed User Longtime User Jun 15, 2023 #2 Tested with this code: Code: 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 Works fine. Upvote 0
Tested with this code: Code: 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 Works fine.
Y ykucuk Well-Known Member Licensed User Longtime User Jun 15, 2023 #3 Erel said: Tested with this code: Code: 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 Works fine. Click to expand... 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 Code: 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 Attachments Screenshot 2023-06-15 at 12.15.21 PM.png 108.6 KB · Views: 492 Upvote 0
Erel said: Tested with this code: Code: 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 Works fine. Click to expand... 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 Code: 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
Erel B4X founder Staff member Licensed User Longtime User Jun 16, 2023 #4 Are you hiding the status bar? Best to take the code I posted and try to reproduce it. Upvote 0
Y ykucuk Well-Known Member Licensed User Longtime User Jun 16, 2023 #5 Erel said: Are you hiding the status bar? Best to take the code I posted and try to reproduce it. Click to expand... 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. Code: <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. Upvote 0
Erel said: Are you hiding the status bar? Best to take the code I posted and try to reproduce it. Click to expand... 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. Code: <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.
Erel B4X founder Staff member Licensed User Longtime User Jun 18, 2023 #6 Please upload a project based on the code that I posted where you can't close the dialog. Upvote 0