Hello,
I managed to post a test ad in my application, but when I associate firebase with AdMob by putting the right package name, nothing is displayed. It's more than a week since I created my application on firebase and AdMob.
In my logs I should have either : IAD_AdFailedToLoad or IAD_AdLoaded but here too nothing is displayed.
I have b4a 8.0
and sdk manager is update
in my code i try a loop when i click on button, because I was advised to try with several trailers.
I add you some photos in case that it can help you to find my problem.
I hope I have not forgotten any information that might be interesting.
This problem is driving me crazy thank you in advance for all the time you can devote.
I managed to post a test ad in my application, but when I associate firebase with AdMob by putting the right package name, nothing is displayed. It's more than a week since I created my application on firebase and AdMob.
In my logs I should have either : IAD_AdFailedToLoad or IAD_AdLoaded but here too nothing is displayed.
I have b4a 8.0
and sdk manager is update
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.
'************ Google Play Services Base ************
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
'************ Google Play Services Base (end) ************
'************ Firebase Base ************
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
'************ Firebase Base (end) ************
'************ Firebase Ads ************
CreateResourceFromFile(Macro, FirebaseAdMob.FirebaseAds)
'************ Firebase Ads (end) ************
in my code i try a loop when i click on button, because I was advised to try with several trailers.
B4X:
#Region Project Attributes
#ApplicationLabel: Ad Mob pub
#VersionCode: 2
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
Private BannerAd As AdView
Private IAd,IAd2,IAd3,Iad4,Iad5 As InterstitialAd
Private Button1 As Button
Private Label1 As Label
Private Label2 As Label
Private Label3 As Label
Private Label4 As Label
Private Label5 As Label
Private Label6 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
Dim a As FirebaseAnalytics
a.Initialize
Log(a.IsGooglePlayServicesAvailable)
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
'test ad id ca-app-pub-3940256099942544/1033173712
IAd.Initialize("IAD", "ca-app-pub-8935643716482518/9334814214")
IAd.LoadAd
IAd2.Initialize("IAD", "ca-app-pub-8935643716482518/7354113164")
IAd2.LoadAd
IAd3.Initialize("IAD", "ca-app-pub-8935643716482518/4500719117")
IAd3.LoadAd
Iad4.Initialize("IAD", "ca-app-pub-8935643716482518/6000243862")
Iad4.LoadAd
Iad5.Initialize("IAD", "ca-app-pub-8935643716482518/4536378137")
Iad5.LoadAd
End Sub
Sub Activity_Click
End Sub
Sub IAD_AdClosed
' IAd.LoadAd 'prepare a new ad
End Sub
Sub IAD_AdFailedToLoad (ErrorMessage As String)
Log("Failed to load ad: " & ErrorMessage)
End Sub
Sub IAD_AdLoaded
Log("Ad loaded")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
Dim a = False
Dim b As Int = 0
Do While a=False
a = BoucleAd(IAd)
Log("1")
Label6.Text=""
Label2.Text="1"
Sleep(200)
If Not (a) Then
a = BoucleAd(IAd2)
Log(" 2")
Label2.Text=""
Label3.Text="2"
Sleep(200)
If Not (a) Then
a = BoucleAd(IAd3)
Log(" 3")
Label3.Text=""
Label4.Text="3"
Sleep(200)
If Not (a) Then
a = BoucleAd(Iad4)
Log(" 4")
Label4.Text=""
Label5.Text="4"
Sleep(200)
If Not (a) Then
a = BoucleAd(Iad5)
Log(" 5")
Label5.Text=""
Label6.Text="5"
Sleep(200)
End If
End If
End If
End If
b = b+1
Label1.Text= "Tentative n° " & b
Loop
End Sub
Sub BoucleAd(add As InterstitialAd) As Boolean
Dim a As Boolean = False
If add.Ready Then
add.Show
a= True
Return a
Else
add.LoadAd
Return a
End If
End Sub
I add you some photos in case that it can help you to find my problem.
I hope I have not forgotten any information that might be interesting.
This problem is driving me crazy thank you in advance for all the time you can devote.
Attachments
Last edited: