Open bolds07 opened 2 years ago
<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/basicBannerAdview" android:layout_width="match_parent" android:layout_height="wrap_content" />
final AdView bannerAdView = findViewById(R.id.basicBannerAdview);
bannerAdView.setAdSize(AdSize.BANNER);
bannerAdView.setAdUnitId("ca-app-pub-2944323778834513/2840086720");
bannerAdView.loadAd(AdMobRequestUtil.buildAdRequest(loc, Collections.emptySet()).build());
bannerAdView.resume();
bannerAdView.setVisibility(View.VISIBLE);
There is a major conflict between admob documentation and admob sdk itself.
Don't take me wrong, I know exactly how to place ads in my apps and I've it working fine for a very long time, but it bugs me off that the documentation states something that clearly doesn't work.
on https://developers.google.com/admob/android/banner it is said:
Warning: Make sure you set the ad size and ad unit ID in the same manner (i.e. set both in XML or both programmatically).
I've never understood why to place such a stupid restriction in the library, but lets just acept it.
The short sentence clearly says that
adunit_id
andadsize
must be set in the same portion of code... NOT SAYING ANYTHING ELSE ABOUT THE OTHER FIELDSSo anyone can conclude from this short sentence that one can declare the adview like:
and later on in the code do:
this is a very simple code, that should work fine according to the documentation. BUT IT DOESN'T
and this has been like this since i started used admob or at least 3 years ago... so guys could you please fix the documentation page?