Android Question AdMob ads problem

WebQuest

Active Member
Licensed User
Hi communities, I am aware that changes have been made to serve admob ads on apps. I'm reading other posts on the case and following the advice, however, I can't implement the ads on my apps. Many of my apps are no longer in line with the admob policies and therefore the ads have been removed. Now I ask you if anyone can give me an example on how to implement the ads with the new rules. I tried them all thanks in advance.
 

asales

Expert
Licensed User
Longtime User
Now I ask you if anyone can give me an example on how to implement the ads with the new rules. I tried them all thanks in advance.
 
Upvote 0

WebQuest

Active Member
Licensed User
Hi I'm following all the instructions to the letter but when I launch the app the loading remains fixed in the middle of the bar without any error. I also tried with the example id but nothing.

if I remove Firebase AdMob and the manifest code then the app starts it works. I am using FireBaseAdMob 1.60.
 
Upvote 0

WebQuest

Active Member
Licensed User
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="28"/>
<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.

CreateResourceFromFile (Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile (Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile (Macro, FirebaseNotifications.FirebaseNotifications)
CreateResourceFromFile (Macro, FirebaseAnalytics.FirebaseAnalytics)
CreateResourceFromFile (Macro, FirebaseAdMob.FirebaseAds)
CreateResourceFromFile (Macro, FirebaseAuth.FirebaseAuth)
'AddReplacement($ADMOB_APP_ID$,ca-app-pub-6756501346137908/5352589791)
AddReplacement($ADMOB_APP_ID$,ca-app-pub-3940256099942544/6300978111)
 
Upvote 0

WebQuest

Active Member
Licensed User
I am using the b4a bridge with wi fi. The app arrives in the middle of the loading bar then nothing happens, I am not shown any errors, the loading remains in the middle of the bar.
 
Upvote 0

WebQuest

Active Member
Licensed User
Hi I created a new project I followed the tutorial to the letter, the app loads but dies when the activity is loaded. I tested all my apps where I had banner ads the same thing happens. I noticed that removing the code from the manifest the app works but without banner so I deduce that the code of the manifest is the problem. I tried leaving only FirbaseAdmob macro, FirbaseAds but nothing the app dies.
B4X:
Sub Load_Banners
    BannerAd.Initialize2("BannerAd","ca-app-pub-3940256099942544/6300978111",BannerAd.SIZE_SMART_BANNER) ' Test Banner
    
    Dim height As Int
    
    If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
        'phones
        If 100%x > 100%y Then height = 62dip 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") 'Test interstitial
    'IAd.Initialize("IAd","ca-app-pub-3940256099942544/1033173712")
    'IAd.LoadAd
    
End Sub
 
Upvote 0

tuhatinhvn

Active Member
Licensed User
Longtime User
You must set application ID ads in AndroidManifest and check your FirebaseAdmob version >1,55 too!
 
Upvote 0

asales

Expert
Licensed User
Longtime User
- Check this:

- Check the unfiltered logs

- You don't checked the example that I posted above, because:
a) there are many phones with ApproximateScreenSize > 6
b) is better to use the Adaptive Banners of the example; you don't need worry about the height of the banner.
 
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
- You don't checked the example that I posted above, because:
a) there are many phones with ApproximateScreenSize > 6
b) is better to use the Adaptive Banners of the example; you don't need worry about the height of the banner.
All that is in my example attached to post #11
 
Upvote 0

WebQuest

Active Member
Licensed User
Use attached file and try it.
I tried your example it always tells me app not installed. I tried bluestacke and the app restarts right away.
I copied the code back into a new project it does the same thing.
 
Last edited:
Upvote 0
If the AdMob service is not linked to Firebase then the 'google-services. json' file does not contain the 'admob_app_id' field which causes the app to crash as soon as it opens.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…