Android Question Problems with AdMob Firebase

Alberto Michelis

Well-Known Member
Licensed User
Hi, my app is now copiled ok but I dont see the adds.
If I add this code to the main activity I see the ad but when I add it to the second activity I dont see any add, this is the 2nd activity code:

B4X:
Sub Activity_Create(FirstTime As Boolean)

    
    Activity.LoadLayout("Dashboard2")                                ' Loads "Page1" layout file
    Activity.Title = "PortIt"
    
    Panel1.Left=Activity.Width/2-Panel1.Width/2
    Panel1.Top=Activity.Height/2-Panel1.Height/2
    Panel1.Elevation = 2dip
    
    PortitCode.ResetUserFontScale(Activity)
    
    '--- AdMob Firebase
    BannerAd.Initialize2("BannerAd", "ca-app-pub-3940256099942544/6300978111", BannerAd.SIZE_SMART_BANNER)
    Dim height As Int
    If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
        'phones
        If 100%x > 100%y Then height = 32dip Else height = 50dip
    Else
        'tablets
        height = 90dip
    End If
    Activity.AddView(BannerAd, 0dip, 100%y - height, 100%x, height)
    BannerAd.LoadAd
    IAd.Initialize("iad", "ca-app-pub-3940256099942544/1033173712")
    IAd.LoadAd
    '--- Fin AdMob Firebase
    
    lMalaInternet.Typeface = Typeface.MONOSPACE
    
    lVersion.Text = "Versión "&Main.VersionNombre
    
    If FirstTime = True Then
        SQL1.Initialize(File.DirInternal, "portit.db", False)
    End If   
    
    AppDir = File.DirInternal
    DBDir = AppDir
    DBName = "portit.db"
    BkpDir = File.DirDefaultExternal
    MaxBackups = 5
    KVStore.Initialize(AppDir, "KVStore")
    DB.Initialize(AppDir, DBName, False)
End Sub
Thanks
 
Top