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
This is because it is still before release. Please do it for testing. Change the advertisement ID before release and release it.