Previously whenever I tested ads, I just used the live ad unit ids from Admob. If I run the app in emulator it used to load ad as SCREEN1 shown below (without TestAd Text overlapping it). And if I run the app in device it will show ads of different ad publishers.
But when I tried to do same today. If I use live ad unit ids then adview will show up as blank (as in SCREEN 2) and it will throw these information in logcat.
I/Ads: No fill from ad server.
W/Ads: Failed to load ad: 3
If I use test ad unit id's provided by google as shown in https://developers.google.com/admob/android/test-ads then it will load up ad as shown in SCREEN1.
SCREEN 1:
Ad is loading up with Test Banner ID
SCREEN 2:
Ad is not loading up with Admob banner ad id
There must be no issue in code since it's loading ads with Test Ad Unit ids but here is the code that I have used below to load the ad.
Code to load banner Id:
mAdView = findViewById(R.id.adView) as AdView
val adRequest = AdRequest.Builder().build()
mAdView.loadAd(adRequest)
BannerView In layout:
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="50dp"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111"
ads:layout_constraintEnd_toEndOf="parent"
ads:layout_constraintStart_toStartOf="parent"
ads:layout_constraintTop_toTopOf="parent">
</com.google.android.gms.ads.AdView>