I was working with adMob, on my emulator with a test ads:adUnitId
when i run my app, the ad loads well, but i keep getting this message in my logcat.
loadAd called while the ad is already loading, so aborting
This is my code in my onCreate
method:
AdView adView = (AdView)this.findViewById(R.id.adView);
AdRequest adResquest = new AdRequest();
adResquest.addTestDevice("blablablablabla");
adView.loadAd(adResquest);
and this is my xml file:
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="a14d7f7d2180609"
ads:loadAdOnCreate="true"
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID" />
Well this happens because you load ads two times.
First in your xml you tell Adview to load ads on create. Then in your activity you load an adRequest in your adView again.
You can either load ads in your activity with :
AdRequest adResquest = new AdRequest();
adResquest.addTestDevice("blablablablabla");
adView.loadAd(adResquest);
or in xml with
ads:loadAdOnCreate="true"
choose one and keep it.
I would suggest deleting the ads:loadAdOnCreate="true" and loadAds in your activity onCreate() Just a personal opinion. Both are the same.
Moreover you should also define your testDevices once. Correct this one too.