Admob ad not showing on emulator or phone

I am trying to place Admob ads in my application and I followed all the instructions but did not work.

AdView adView = new AdView(this, AdSize.BANNER, "My_ID");
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    flashCardPage.addView(adView, lp);
    adView.loadAd(new AdRequest());

My manifest file contains an activity tag and two permissions, like a tutorial, but the banner does not appear on the screen. Interestingly, when I extracted all the Admob materials from my manifest file and launched the application, a banner appeared at the bottom of the screen saying that I need to allow Internet access and network access. Does anyone know what I'm doing wrong? I know that there are already many questions on this topic, but none of them helped. I tried changing my Admob account in test mode and adding an emulator as a test project, but that didn't work.

Should I try to use a different way of advertising? About a week has passed and Admob ads are still not showing.

When I launched the application on my phone today (August 10), I had a forced shutdown, so I think that if Admob causes this, even only in 1% -5% of cases, I will not use it.

+5
source share
5 answers

Perhaps if AdMob just doesnโ€™t have any ads to display, you can try adding this piece of code after the adView ad to see what it says when you didnโ€™t receive the ad.

 // Set AdListener
        adView.setAdListener(new AdListener() {
            @Override
            public void onFailedToReceiveAd(Ad ad, ErrorCode error) {
                System.err.println("Ad failed: " + ad.toString() + error.toString());    
            }

            @Override
            public void onReceiveAd(Ad ad) {
                System.out.println("Ad received: " + ad.toString());
            }
        });
+4
source

admob, "ca-app-pub-" "pub"?

" 1" Google Admob "Google Mobile Ads SDK" admob, .

.

+2

admob. , . , , - . . .

0

xml. , , admob.

. com.google.ads.AdView.

admob, login " " ( , ), . , " ". , . , , ..

0

- !

-1
source

All Articles