Issue:
I am having issues successfully implementing FirebaseAdMob2 in test mode in a test app that I have made.
Having only a banner ad as adview , and while running the test app the banner ad displays blank.
I have executed the following:
On Google AdMob portal:
When I launch the code, the ad banner appears blank.
I set the backcolor of the ad banner to Red to make sure that it the view is rendering on the page and laid out properly.
When I launch the code, the adview banner does display, however it is not visible for 5 seconds until it finally displays red.
Then No test ad ever displays within the banner adview afterwards.
There are no exceptions thrown.
There is no messages printing in the output log.
I am using android-30, and the minSdkVersion is 5 while the targetSdkVersion is 30.
Also:
I downloaded the b4xpages_admob_example2.zip to try running their example. (My test app code is not based on this)
When running this example I get the following error: "error: method does not override or implement a method from a supertype"
My Code:
I have read the admob documentation, and b4x admob documentation, as well as searched through the forum.
Without any messages, or errors, I am unsure as to why the ad is blank.
Is there something I am missing? Or have done incorrectly as to why the ad displays blank?
Thanks.
I am having issues successfully implementing FirebaseAdMob2 in test mode in a test app that I have made.
Having only a banner ad as adview , and while running the test app the banner ad displays blank.
I have executed the following:
On Google AdMob portal:
- I created an account today
- Created an app (the app says review required, from what I read it is because it is not on playstore)
- Created a test device (I used the ad ID from a test phone's settings)
- I created a blank b4xpage project and inserted the banner ad code found in the example on Erel's FirebaseAdMob2 post
- I inserted the example code for the manifest editor found on the same post
- I added the FirebaseAdMob2 v 2.13 library reference (after downloading the latest version of B4A)
- I am using JDK version 8 and have the path set in path configuration
- I launched the SDK manager and verified that I have firebase-ads (Google Maven) v 19.4.0 installed
- I replaced the App ID, Banner ID, and Device ID default code from the example with the correct codes
When I launch the code, the ad banner appears blank.
I set the backcolor of the ad banner to Red to make sure that it the view is rendering on the page and laid out properly.
When I launch the code, the adview banner does display, however it is not visible for 5 seconds until it finally displays red.
Then No test ad ever displays within the banner adview afterwards.
There are no exceptions thrown.
There is no messages printing in the output log.
I am using android-30, and the minSdkVersion is 5 while the targetSdkVersion is 30.
Also:
I downloaded the b4xpages_admob_example2.zip to try running their example. (My test app code is not based on this)
When running this example I get the following error: "error: method does not override or implement a method from a supertype"
My Code:
Test App Code:
#Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Dim bannerad As AdView
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")
Dim m As MobileAds
Wait For (m.Initialize) MobileAds_Ready
m.SetConfiguration(m.CreateRequestConfigurationBuilder(Array(MY_DEVICE_ID))) 'optional. Array with test device ids. See unfiltered logs to find id.
Dim AdaptiveSize As Map = GetAdaptiveAdSize
'Add Private BannerAd As AdView in Globals sub
bannerad.Initialize2("BannerAd", MY_AD_UNIT_ID,AdaptiveSize.Get("native"))
bannerad.Color = Colors.red
Root.AddView(bannerad, 0, 0, AdaptiveSize.Get("width"), AdaptiveSize.Get("height"))
bannerad.LoadAd
End Sub
Sub GetAdaptiveAdSize As Map
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim AdSize As JavaObject
Dim width As Int = 100%x / GetDeviceLayoutValues.Scale
Dim Native As JavaObject = AdSize.InitializeStatic("com.google.android.gms.ads.AdSize").RunMethod("getCurrentOrientationAnchoredAdaptiveBannerAdSize", Array(ctxt, width))
Return CreateMap("native": Native, "width": Native.RunMethod("getWidthInPixels", Array(ctxt)), _
"height": Native.RunMethod("getHeightInPixels", Array(ctxt)))
End Sub
Sub Ad_ReceiveAd
Log("Adview received")
End Sub
Sub Ad_FailedToReceiveAd (ErrorCode As String)
Log("Failed: " & ErrorCode)
End Sub
Sub Ad_AdClosed
Log("Closed")
End Sub
Sub Ad_AdOpened
Log("Opened")
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Private Sub Button1_Click
xui.MsgboxAsync("Hello world!", "B4X")
End Sub
I have read the admob documentation, and b4x admob documentation, as well as searched through the forum.
Without any messages, or errors, I am unsure as to why the ad is blank.
Is there something I am missing? Or have done incorrectly as to why the ad displays blank?
Thanks.
Last edited: