Home > Software engineering >  Why Admob test ads don't show
Why Admob test ads don't show

Time:10-08

I've been having this problem for 3 days. I started developing applications with test ads to update the applications published in the store. But by no means did the test ads appear in the 2 apps. I suspected it because I was using old library. But when I created a new project and tested it, I saw test ads showing. I could not see any test ads in the applications published in the store. I would be very grateful for any help.

Error code:

failed to load: 3 --> ERROR_CODE_NO_FILL

build.gradle:

implementation 'com.google.android.gms:play-services-ads:19.4.0'


//and...
dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath 'com.google.gms:google-services:4.3.0'
    }

Activity:

private InterstitialAd mInterstitialAd;

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity);

    MobileAds.initialize(this, "ca-app-pub-3940256099942544~3347511713");

    mInterstitialAd = new InterstitialAd(this);
    mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
    mInterstitialAd.loadAd(new AdRequest.Builder().build());

    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdClosed() {
            super.onAdClosed();
            Log.d("testad","onAdClosed");
        }

        @Override
        public void onAdFailedToLoad(int i) {
            super.onAdFailedToLoad(i);
            Log.d("testad","onAdFailedToLoad" i);

            mInterstitialAd.loadAd(new AdRequest.Builder().build());
        }

        @Override
        public void onAdLeftApplication() {
            super.onAdLeftApplication();
            Log.d("testad","onAdLeftApplication");
        }

        @Override
        public void onAdOpened() {
            super.onAdOpened();
            Log.d("testad","onAdOpened");
        }

        @Override
        public void onAdLoaded() {
            super.onAdLoaded();
            Log.d("testad","onAdLoaded");
        }
    });

Android Manifest:

//...
<meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-3940256099942544~3347511713" />

</application>

I tried:

I reset the ad ID from device settings.

I added the device as a test device.

I tried with different network connection.

I tried with different device.

CodePudding user response:

If your test ads are working, but your real ads are not loading. It doesn't mean that your implementation is wrong. Admob doesn't show real until your app gets a certain amount of traffic. If there is low traffic on your app, then AdMob would show very few or no ads.

failed to load: 3 --> ERROR_CODE_NO_FILL

This error is clearly showing AdMob has no fill for your ads now. If test ads are working fine, then your real ads would load fine too, once AdMob starts to deliver them.

Don't try to load real ads from your devices, Admob will place a limited ad serving if they detect you are trying to load ads by yourself.


You are using an older AdMob SDK, the current version is 20.4.0. There are many API changes introduced in version 19.7.0 and some classes are deprecated and renamed.

The interstitial constructor you are using for initialization is now deprecated. You have to use the static load() method for creating an interstitial ad instance.

Now you have to initialize and use Interstitial ads like this

private InterstitialAd mInterstitialAd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      .
      .
      .
      AdRequest adRequest = new AdRequest.Builder().build();

      InterstitialAd.load(this,"ca-app-pub-3940256099942544/1033173712", adRequest,
        new InterstitialAdLoadCallback() {
      @Override
      public void onAdLoaded(@NonNull InterstitialAd interstitialAd) {
        // The mInterstitialAd reference will be null until
        // an ad is loaded.
        mInterstitialAd = interstitialAd;
        Log.i(TAG, "onAdLoaded");
      }

      @Override
      public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
        // Handle the error
        Log.i(TAG, loadAdError.getMessage());
        mInterstitialAd = null;
      }
    });
  }

Now show it by calling show() method

if (mInterstitialAd != null) {
  mInterstitialAd.show(MyActivity.this);
} else {
  Log.d("TAG", "The interstitial ad wasn't ready yet.");
}

CodePudding user response:

I'm facing the same issue in React Native. First, my test ads were showing then I uploaded the app to the google play store and the app store. A few days later ads limit was marked on my account after 15 days that limit is removed but now ads are not showing even not Test ads. I changed the bundle name and then test ads show. It means integration is ok there must be an issue on the account side.

  • Related