1

Is it possible to add Admob banner in every Items xml for showing in ViewPager2? So when user scrolling to down or up the ViewPager2 every time Admob will be seen? It is my xml

It is a simple item row

  <TextView
        android:id="@+id/textView17"
        android:layout_width="189dp"
        android:layout_height="40dp"
        android:gravity="center"
        android:text="username"
        android:textColor="@color/black"
        app:layout_constraintBottom_toTopOf="@+id/adView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />
    <com.google.android.gms.ads.AdView
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        ads:layout_constraintBottom_toBottomOf="parent"
        ads:layout_constraintStart_toStartOf="parent"
        ads:layout_constraintEnd_toEndOf="parent"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
    </com.google.android.gms.ads.AdView>

    <ImageView
        android:id="@+id/imageView20"
        android:layout_width="279dp"
        android:layout_height="356dp"
        app:layout_constraintBottom_toTopOf="@+id/textView17"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:srcCompat="@tools:sample/avatars" />

1 Answers1

0

Technically you can do this, but AdMob Discourages showing 2 banners on the screen at any given time, which may occur if you have this implementation. Also Admob SDK will make the banner disappear if it created two banner at the same time.

My Recommendation: is to have a buffer between items (for example: show the banner on every 5th item)

user16930239
  • 6,319
  • 2
  • 9
  • 33
  • 1
    Firstly thanks for response sir. Your response is belongs to only real Admob banner? Because i implemented there Test Admob at it shows every time without any blocking. – terlan abaszade Nov 14 '22 at 16:51
  • @terlanabaszade it will work on testing but it will stop showing on production. – user16930239 Nov 14 '22 at 18:03