0

I am trying to display banner ads on my first app, the banner Im using is the Adaptive Banner.

I have made my banner on admob since 3 weeks and the test ads are working fine but when I try to replace the test banner unit id with my banner unit id, Ads are not being displayed on my app, I also tried to set my own device as a test device and I found the test ads working well too, the error code I found is 3 No fill), I also have tried to run my app on other devices using the emulator and I didn't see ads as well, I also have tried some solutions I found on this topic failed to load ad : 3 but nothing changed.

I got to mention that I have received an email from Admob saying that my account has been approved and I have added my Payment information (except the payment method because it's not allowing me to add until I get 100 dollars on the account), I also didn't make an account on the Play console yet.

Here is the code of displaying ads:

public void displayAds()
{
    adView = new AdView(getApplicationContext());

    AdSize adSize = getAdSize();

    adView.setAdSize(adSize);

    adView.setAdUnitId(ADAPTIVE_BANNER_AD_UNIT_ID);

    adView.setAdListener(new AdViewListener());

    frameLayout.addView(adView);

    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
            FrameLayout.LayoutParams.WRAP_CONTENT);

    params.gravity = Gravity.BOTTOM;

    adView.setLayoutParams(params);
    

 /* RequestConfiguration requestConfiguration =
    new RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList        ("4D873959D076ACA64E5CE1643BC96B09")).build();

    MobileAds.setRequestConfiguration(requestConfiguration);*/

    for (int i = 0; i < 5000; i++) {

        AdRequest adRequest = new AdRequest.Builder().build();

        adView.loadAd(adRequest);
    }
  }

 public AdSize getAdSize()
{
    Display display = getWindowManager().getDefaultDisplay();

    DisplayMetrics outMetrics = new DisplayMetrics();

    display.getMetrics(outMetrics);

    float widthPixels = outMetrics.widthPixels;

    float density = outMetrics.density;

    int adWidth = (int) (widthPixels/density);

    Log.d("adWidth",String.valueOf(adWidth));

    return AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(this,adWidth);
}

And here is the LoadAdErrorMessage and LoadAd errorCode that I receive on the Logcat:

2020-10-08 08:59:17.130 29413-29413/com.example.naturesounds D/LoadAdErrorMessage: No ad config.
2020-10-08 08:59:17.130 29413-29413/com.example.naturesounds D/LoadAdErrorCode: 3

1 Answers1

0

This is because it is still before release. Please do it for testing. Change the advertisement ID before release and release it.

  • The documentation didn't mention that real ads should be displayed after releasing/publishing the app?? – mohamed rabiaa Oct 08 '20 at 08:41
  • public static final int ERROR_CODE_NO_FILL The ad request was successful, but no ad was returned due to lack of ad inventory. Constant Value: 3 https://developers.google.com/android/reference/com/google/android/gms/ads/AdRequest#ERROR_CODE_NO_FILL Your app is still pre-release, so it doesn't appear because there is no advertisement on your ID –  Oct 08 '20 at 08:55
  • Using a translator may make the words strange, but I want you to be patient and interpret what I want :) –  Oct 08 '20 at 08:57
  • Lol I didn't use a translator(my English is Upper intermidiate) and again I have saw the document and many topics from google and no one mentioned that The app should be released to display ads???? – mohamed rabiaa Oct 08 '20 at 09:08
  • There is a misunderstanding that I am using a translator Before the release, your admob ID has no ads in the ad inventory, so it is natural that there are no ads to show. Look at the AdMob documentation I uploaded and look at the error code you returned. https://developers.google.com/android/reference/com/google/android/gms/ads/AdRequest#ERROR_CODE_NO_FILL –  Oct 08 '20 at 09:17
  • https://stackoverflow.com/questions/33566485/failed-to-load-ad-3?noredirect=1&lq=1 Everyone says they have to release, but you don't think to hear it Think about it –  Oct 08 '20 at 09:22
  • Well they say it takes time to show the ad after creating the ad on admob and I mentioned that I have done that 3 weeks ago so its enough, I also tried to generate a release APK and installed it on my device but It didn't go well – mohamed rabiaa Oct 08 '20 at 09:30