I have integrated firebase admob in my android app, and have setup properly for the adview to work, but logcat constantly shows this message: logcat message
and i've tried the test adunit id provided on the admob documentation site, it worked fine, but when i switched to my own admob app id and ad unit ad, it just didn't work, could anybody help me? appreciated a lot!
this is my code:
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
MobileAds.initialize(getActivity(), "admob app id");
fetchBooks();
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_book_gallery, container, false);
//.........
adView = v.findViewById(R.id.ad_view);
AdRequest request = new AdRequest.Builder().addTestDevice("AE61276545183AF0466F05469FD032CC").build();
adView.loadAd(request);
//...........
return v;
}
this is my xml file
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".BookGalleryActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v7.widget.RecyclerView>
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/ad_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
ads:adSize="BANNER"
ads:adUnitId="ad unit id">
</com.google.android.gms.ads.AdView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|left"
android:layout_marginLeft="16dp"
android:layout_marginBottom="64dp"
android:src="@drawable/dice"/>
</android.support.design.widget.CoordinatorLayout>