rickyxd
rickyxd

Reputation: 247

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 test ads nor live ads. This is the log:

I/Ads: Updating ad debug logging enablement.
I/Ads: Starting ad request.
    SDK version: afma-sdk-a-v13280019.11910000.1
I/Ads: This request is sent from a test device.
W/Ads: Not retrying to fetch app settings
W/Ads: Update ad debug logging enablement as false
W/Ads: App does not have the required permissions to get location
    I/Ads: Trying mediation network: 
    I/Ads: Instantiating mediation adapter: com.google.DummyAdapter
    I/Ads: No fill from any mediation ad networks.
    I/Ads: Scheduling ad refresh 60000 milliseconds from now.
    W/Ads: Failed to load ad: 3

My test interstitial loads with no problem, the live one doesn't. The banner does not show, not the test one nor the live one.

This is my xml AdView:

<com.google.android.gms.ads.AdView
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom="true"
            ads:adSize="BANNER"
            ads:adUnitId="ca-app-pub-3940256099942544/6300978111"> //test admob unit id
</com.google.android.gms.ads.AdView>

And I load the banner with:

     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);

The live interstitial is loaded in this way, and it works (the test one does not):

final InterstitialAd mInterstitialAd = new InterstitialAd(this);
          mInterstitialAd.setAdUnitId("_live_ad_id");
          mInterstitialAd.loadAd(new AdRequest.Builder().addTestDevice("my_test_device_id").build());
          mInterstitialAd.setAdListener(new AdListener(){
              @Override
              public void onAdLoaded(){
                  mInterstitialAd.show();

              }
          });
          if (mInterstitialAd.isLoaded()) {
          } else {
              Log.d("TAG", "The interstitial wasn't loaded yet.");
          }

Things I've tried

Nothing worked. From what I've understood my log say the ad request is successful but admob does not have ads to display at the moment. Maybe the live ads are not shown because my app is not live yet but why the test ads does not show? And why only the live interstitial ad work? I also thought my admob account could be disabled but the ads works on my other applications.

Upvotes: 5

Views: 8299

Answers (2)

Dakroub_M
Dakroub_M

Reputation: 122

This might be old but perhaps it helps someone.

You could be receiving this error for many reasons.

Two other reasons are:

  1. 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.
  2. If you are using production IDs, your account may not be active yet; You simply have to wait until it becomes active.

Upvotes: 1

iamkdblue
iamkdblue

Reputation: 3622

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
                public void onAdLoaded() {
                    mInterstitialAd.show();
                    super.onAdLoaded();

                }
            });

Upvotes: 3

Related Questions