Android Question Admob Ads (SOLVED)

walterf25

Expert
Licensed User
Longtime User
I have implemented Admob ads into one of my apps it's been more than 4 days and I still can't see any ads, is anyone else experiencing this issue? I don't believe I'm missing anything, I have spent hours checking and making sure I followed the implementation instructions and I can't seem to find anything wrong, any ideas?

Thanks,
Walter
 

walterf25

Expert
Licensed User
Longtime User
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Do you get the "no fill" error code? Have you checked the unfiltered logs?
I keep getting error code 3, which according to the documentation means there's no inventory, but i would think that after 4 almost 5 days wouldn't be the case anymore.

Walter
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
I've tried that as well and I don't see any ads either.

Walter
If it's not working with test ads then there might be an issue with your implementation. AFAIK you should always be able to get a test ad regardless of whether there would normally be a paying ad available (ie: even if you live in the Antarctic!).

- Colin.
 
Upvote 0

eps

Expert
Licensed User
Longtime User
What sort of ads are you trying to display?

Do you see any ad requests or impressions in the AdMob or FireBase Consoles?
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Upvote 0

walterf25

Expert
Licensed User
Longtime User
What sort of ads are you trying to display?

Do you see any ad requests or impressions in the AdMob or FireBase Consoles?
Just regular banner ads.

Walter
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
If it's not working with test ads then there might be an issue with your implementation. AFAIK you should always be able to get a test ad regardless of whether there would normally be a paying ad available (ie: even if you live in the Antarctic!).

- Colin.
Set up is OK, i just confirmed it by adding a Test Ad ID and it shows up just fine.

But If i use my created Ad ID it doesn't show anything.

Walter
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Set up is OK, i just confirmed it by adding a Test Ad ID and it shows up just fine.

But If i use my created Ad ID it doesn't show anything.

Walter
OK - so if you're receiving test ads, then the problem is not in your app. It's either that there are just no ads currently available to be served, or there's an issue with your AdMob account. Have you used AdMob before? If it's a new AdMob account, make sure you have provided your payment information. Apparently you won't get any ads if you haven't.

If everything looks OK with your account, reach out to AdMob support & they may be able to look into it for you.

- Colin.
 
  • Like
Reactions: eps
Upvote 0

eps

Expert
Licensed User
Longtime User
+1 for Payment Information and check the Consoles... Firebase and Admob, they should show something in there, either that no ads have been requested or that at least something has happened etc...
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
I have checked the unfiltered logs once again, I created another ad unit and have also changed the package name of the application and linked it with firebase, basically I have created a whole new project and have added the new Ad Unit ID to the project and I now see this error in the unfiltered logs.

"Class com.google.android.gms.ads.VideoController failed lock verification and will run slower. Class com.google.android.gms.internal.ads.zzkd failed lock verification and will run slower. ad height = 131 Class com.google.android.gms.internal.ads.zzkb failed lock verification and will run slower. Class com.google.android.gms.internal.ads.zzjr failed lock verification and will run slower. Class com.google.android.gms.internal.ads.zzni failed lock verification and will run slower. Class com.google.android.gms.dynamite.DynamiteModule failed lock verification and will run slower. Skipping duplicate class check due to unrecognized classloader Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:11020 Selected remote version of com.google.android.gms.ads.dynamite, version >= 11020 Skipping duplicate class check due to unrecognized classloader Instantiated singleton DynamitePackage. Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl Updating ad debug logging enablement. Use AdRequest.Builder.addTestDevice("865BF86C54272BFD5EF122E568DC36F2") to get test ads on this device. Skipping duplicate class check due to unrecognized classloader"]

Not sure if this indicates that there is in fact an issue, i'm running out of time and started wrapping another Ads library, if I can get Admob to work that would be ideal, but i'm running out of time and patience as well, I have used Admob before and never had this issue.

Feeling frustrated :mad:

Walter
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Have you got all the latest libraries and so on? Good WiFi or 4G signal? Any bits of code or library uses you can show us?
I am using the latest FireBaseAdmob library version 1.5, i have updated google play services and all of firebase libraries, here's the relevant part of my code

Manifest entries:
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="5" 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)

SetApplicationAttribute(android:theme, "@style/MyAppTheme")

CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">#0098FF</item>
        <item name="colorPrimaryDark">#0288d1</item>
        <item name="colorAccent">#AAAA00</item>
        <item name="android:navigationBarColor">#0288d1</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
    </style>
</resources>
)

AddPermission(android.permission.ACCESS_COARSE_LOCATION)
AddPermission(android.permission.ACCESS_FINE_LOCATION)
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.ACCESS_WIFI_STATE)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)

CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
CreateResourceFromFile(Macro, FirebaseAdMob.FirebaseAds)
    
'''Google Maps
    AddApplicationText(
<meta-data
  android:name="com.google.android.geo.API_KEY"
  android:value="AIzaSyBYHNLaZKLg5bDP7ZVnCglJK-UfbFnXl2A"/>
)

And here's the Actual code in my Routes Activity:
B4X:
Private admob As AdView

admob.Initialize2("admob", "ca-app-pub-3936850409264775/7701061741", admob.SIZE_SMART_BANNER)
    Dim height As Int
    If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
        'phones
        If 100%x > 100%y Then
             height = 32dip
        Else
            height = 50dip
        End If
    Else
        'tablets
        height = 90dip
    End If
    
    pnlAd.AddView(admob, 0, pnlAd.Height/2 - height/2, 100%x, height)
    pnlAd.Top = 100%y - 50dip
    pnlAd.Height = height

    admob.LoadAd

I also have this in the Starter Service to allow the user to give consent to continue using ads.
B4X:
Sub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.
    consent.Initialize("consent")
    consent.RequestInfoUpdate(Array("pub-3936850409264775"))
    Log("requesting info update")
    Wait For consent_InfoUpdated (Success As Boolean)
    If Success = False Then
        Log($"Error getting consent state: ${LastException}"$)
    End If
    Log($"Consent state: ${consent.ConsentState}"$)
    Log("EU: " & consent.IsRequestLocationInEeaOrUnknown)
    Do While IsPaused(Routes)
        Sleep(100)
    Loop
    CallSubDelayed(Routes, "ConsentStateAvailable")
End Sub

And the ConsentStateAvailable code in the Routes Activity is the following:
B4X:
Sub ConsentStateAvailable
    Dim consent As ConsentManager = Starter.consent
    If consent.ConsentState = consent.STATE_UNKNOWN Then ''And consent.IsRequestLocationInEeaOrUnknown
        Dim stu As StringUtils

        Dim dialog1 As CustomLayoutDialog

        Dim sf As Object = dialog1.ShowAsync("", "OK", "", "", Null, False)
        Wait For (sf) Dialog_Ready (DialogPanel As Panel)
        DialogPanel.LoadLayout("frmAdmobConsens")

        lblAppName.Text = Application.LabelName
        lblInfo1.Text = "This is a Free App and contains ads in order to support the development."
        lblInfo2.Text = "Do we have your permission to continue displaying ads?"
        lblInfo3.Text = "Please make a Selection for " & Application.LabelName & " You can always change your selection in the App Settings"

        lblInfo1.Height = stu.MeasureMultilineTextHeight(lblInfo1, lblInfo1.Text) + 10dip
        lblInfo2.Height = stu.MeasureMultilineTextHeight(lblInfo2, lblInfo2.Text) + 10dip
        lblInfo3.Height = stu.MeasureMultilineTextHeight(lblInfo3, lblInfo3.Text) + 10dip

        lblInfo2.Top = lblInfo1.Top + lblInfo1.Height
        lblInfo3.Top = lblInfo2.Top + lblInfo2.Height
        
        RadioButton1.Top = lblInfo3.Top + lblInfo3.Height
        RadioButton2.Top = RadioButton1.Top + RadioButton1.Height
        RadioButton3.Top = RadioButton2.Top + RadioButton2.Height

        RadioButton1.Text = "Yes, Continue with personalized Ads"
        RadioButton2.Text = "No, I do not want to see personalized Ads"
        RadioButton3.Text = "No, I do not want to see any Ads."
        
        pnlAdmobConsens.Height = 10dip + lblAppName.Height + lblInfo1.Height + lblInfo2.Height + lblInfo3.Height + RadioButton1.Height + RadioButton2.Height +         RadioButton3.Height
        dialog1.SetSize(100%x, 80dip + pnlAdmobConsens.Height)
        
        Wait For (sf) Dialog_Result (Result As Int)
 
        If RadioButton1.Checked Then
            consent.ConsentState = consent.STATE_PERSONALIZED
        else if RadioButton2.Checked Then
            consent.ConsentState = consent.STATE_NON_PERSONALIZED
        else if RadioButton3.Checked Then
            consent.ConsentState = consent.STATE_UNKNOWN
            ExitApplication
        End If
        'LogColor($"Consent form result: ${consent.ConsentState}"$, Colors.Red)
    End If
    LoadAd
End Sub

Sub LoadAd
    Dim builder As AdRequestBuilder
    builder.Initialize
    Dim consent As ConsentManager = Starter.consent
    If consent.IsRequestLocationInEeaOrUnknown Then
        If consent.ConsentState = consent.STATE_NON_PERSONALIZED Then
            builder.NonPersonalizedAds
        Else if consent.ConsentState = consent.STATE_UNKNOWN Then
            Return
        End If
    End If
    ''builder.AddTestDevice("865BF86C54272BFD5EF122E568DC36F2")
    admob.LoadAdWithBuilder(builder)
End Sub

And of course I have the subs to handle the adreceived and the failedtoreceiveAd subs:
B4X:
Sub admob_ReceiveAd
    Log("Ad received")
End Sub

Sub admob_FailedToReceiveAd (ErrorCode As String)
    Log("failed to receive ad: " & ErrorCode)
End Sub

Walter
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Found this in their google forum, it seems there are more people experiencing the same issue.

https://productforums.google.com/fo...k;context-place=forum/google-admob-help-forum

Walter
It's certainly not unheard of for AdMob to release an update to the SDK that breaks previously working ads. I've seen it happen a few times before, so I wonder if this is a bug related to the latest SDK release?

Having said that, you might want to look at the release notes -> https://developers.google.com/admob/android/rel-notes

In particular, there is this from AdMob v17.0.0:

  • Google AdMob publishers are required to specify a <meta-data> tag with keycom.google.android.gms.ads.APPLICATION_ID in their AndroidManifest.xml. Refer to the Get Started guide for more details.

Although it says in the Get Started Guide that failure to ad the APPLICATION_ID will result in a crash on initialization, so this might not be relevant.

- Colin.
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
It's certainly not unheard of for AdMob to release an update to the SDK that breaks previously working ads. I've seen it happen a few times before, so I wonder if this is a bug related to the latest SDK release?

Having said that, you might want to look at the release notes -> https://developers.google.com/admob/android/rel-notes

In particular, there is this from AdMob v17.0.0:



Although it says in the Get Started Guide that failure to ad the APPLICATION_ID will result in a crash on initialization, so this might not be relevant.

- Colin.
Thanks, i've also added that meta tag in the manifest file but it makes no difference.

Walter
 
Upvote 0
Top