Sub Globals Private adview1 As NativeExpressAd End Sub Sub Activity_Create(FirstTime As Boolean) adview1.Initialize("Ad", "ca-app-pub-126757084444444/44444444", 100%x, 200dip) 'change the ad unit id Activity.AddView(adview1, 0, 0, 100%x, 200dip) adview1.LoadAd End Sub Sub Ad_FailedToReceiveAd (ErrorCode As String) Log("failed: " & ErrorCode) End Sub Sub Ad_ReceiveAd Log("received") End Sub Sub Ad_AdScreenDismissed Log("Dismissed") End Sub Sub Activity_Pause (UserClosed As Boolean) adview1.Pause End Sub Sub Activity_Resume adview1.Resume End Sub
You need to replace the "ca-app..." with the id of the ad you created in the AdMob console.Hi there. Please, as usual, excuse me for my "noobing"
This is the first time I'm tring to use AdMod and, obviously, the first time I'm tring to configure it in B4A.
I followed the tutorials, all went ok: now in my app (still not released!) I can see the test-ads-banner.
But ... how to switch to the "real one"?
I mean: I registered in Firebase as suggested, but there's a key or something I've to put in my app?
I mean something to substitute this line of code:
anyway I can't find it in my Firebase control panel ...B4X:
BannerAd.Initialize2("BannerAd", "ca-app-pub-3940256099942544/6300978111", BannerAd.SIZE_SMART_BANNER)
Received error HTTP response code: 403 There was a problem getting an ad response. ErrorCode: 0 Failed to load ad: 0 Starting ad request. Use AdRequest.Builder.addTestDevice("XXXXXXXXXXXXXXXXXXXXX") to get test ads on this device.
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
BannerAd.Initialize2("BannerAd", "ca-app-pub-3940256099942544/6300978111", BannerAd.SIZE_SMART_BANNER) Dim AdMobHeight As Int Dim ScreenHeightScaled As Float ScreenHeightScaled = GetDeviceLayoutValues.Height / GetDeviceLayoutValues.Scale ' Ad height 32dip: device screen height <= 400 ' Ad height 50dip: 400 < device screen height <= 720 ' Ad height 90dip: device screen height > 720 If ScreenHeightScaled <= 400 Then AdMobHeight = 32dip Else if ScreenHeightScaled > 400 And ScreenHeightScaled <= 720 Then AdMobHeight = 50dip Else if ScreenHeightScaled > 720 Then AdMobHeight = 90dip End If Activity.AddView(BannerAd, 0dip, 100%y - AdMobHeight, 100%x, AdMobHeight)
Sub iad_FailedToReceiveAd (ErrorCode As String) Log("not Received - " &"Error Code: "&ErrorCode) IAd.LoadAd End Sub
If you go into your AdMob console & click on the app name, it will show you the ads that have been set up for that app, what type they are & the id of the ad (eg: "ca-app-pub...").Hello, one question i create a banner in admob.
in the confirmation email i receive two ca-app-pub
wich one is AdView and the InterstitialAd.