Android: AdMob not working
Just adding this in case someone else has the same problem as mine.
I tried using a new Ads Unit ID
and that didn't work as well. In the end, the issue was because I was trying to fix an app that got suspended from Google Play and Admob had also actually stopped serving ads to applications with the specific package name / bundle ID
.
Changing the package name
of the application solved the issue for me.
I don't find any issue with your code/layout. Issue could be with the Ads Unit Id
.
I would suggest you to try creating a different Ads Unit Id
Hope it works.
Be careful of the ad-unit id string. My error was a space in the end of the adUnitId
In your layout file (activity_welcome.xml), the adview container (RelativeLayout) layout width/height looks strange to me. And I think it is useless in your use case.
Change from:
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentBottom="true" >
<com.google.android.gms.ads.AdView
android:id="@+id/welcomeAdView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="pub-***************" />
</RelativeLayout>
to:
<com.google.android.gms.ads.AdView
android:id="@+id/welcomeAdView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="pub-***************" />