Admob Does Not Show Test Ads Nor Real Ads
I've been struggling with Admob ads for almost a week now and I searched all over the internet to find a possible solution but nothing worked. My Android application does not show
Solution 1:
change your ads:adUnitId="ca-app-pub-3940256099942544/6300978111"
to ads:adUnitId="your_banner_id"
Note:ca-app-pub-3940256099942544/6300978111
its for testing !
try this code for banner
MobileAds.initialize(this, getString(R.string.app_id));
adView1 = findViewById(R.id.adView);
AdRequest adRequest1 = new AdRequest.Builder().addTestDevice("my_test_device_id").build();
adView1.loadAd(adRequest1);
For InterstitialAd
MobileAds.initialize(LoginActivity.this, getResources().getString(R.string.app_id));
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId(getResources().getString(R.string.full_screen_ads_id));
mInterstitialAd.loadAd(new AdRequest.Builder()
.build());
mInterstitialAd.setAdListener(new com.google.android.gms.ads.AdListener() {
@Override
publicvoidonAdLoaded() {
mInterstitialAd.show();
super.onAdLoaded();
}
});
Solution 2:
This might be old but perhaps it helps someone.
You could be receiving this error for many reasons.
Two other reasons are:
- If you are using test ads and everything is setup correctly, Google might be blocking your app id (com.example.myapp) for some reasons if you previously were on production (Billing, address, etc...), it won't even work on test IDs; try changing your app id and check if it works.
- If you are using production IDs, your account may not be active yet; You simply have to wait until it becomes active.
Post a Comment for "Admob Does Not Show Test Ads Nor Real Ads"