1

I have a RecyclerView in which I have put the AdMob ad.

I have written this code to show the ad having same Ad unit ID at random positions in the recyclerview:

Random rand = new Random();

NativeExpressAdView adView = (NativeExpressAdView) itemView.findViewById(R.id.adView);
adView.setVisibility(View.GONE);

if (count >= random) {
    random = rand.nextInt(3);  // Reset the counter to random integer
    count = 0;
    adView.setVisibility(View.VISIBLE);

    AdRequest request = new AdRequest.Builder()
            .addTestDevice("********")
            .addTestDevice("********")
            .build();
    adView.loadAd(request);

} else {
    count++;
} 

here's the xml part:

<com.google.android.gms.ads.NativeExpressAdView
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    ads:adUnitId="ca-app-pub-***/***"
    ads:adSize="320x80">
</com.google.android.gms.ads.NativeExpressAdView>

So, I just want to know that is this a good practice or is there any policy violation or such thing in doing this?

Please let me know.

Yaroslav
  • 651
  • 2
  • 9
  • 17
Hammad Nasir
  • 2,889
  • 7
  • 52
  • 133

3 Answers3

3

I asked this question on Google Groups too and just got a reply from a guy named 'Vu Chau (Mobile Ads SDK Team)' via Google Mobile Ads SDK Developers.

He said that:

Using one ad unit ID for your native express ads in a RecyclerView implementation is fine. If you check our NativeExpressRecyclerViewExample, you can see we also use one ad unit ID.

Whoa! Thanks Vu Chau!

Pang
  • 9,564
  • 146
  • 81
  • 122
Hammad Nasir
  • 2,889
  • 7
  • 52
  • 133
0

I recommend creating different ad units for each placement of native ads. This way you can analyze the performance for each one individually and take appropriate actions.

if You have single Ad unit which is display many times. admob will think that you are creating illegal traffic and they will keep on cutting Earning.

In recyclerView Use at least 2-3 ad unit

xbadal
  • 1,284
  • 2
  • 11
  • 24
  • `In recyclerView Use at least 2-3 ad unit` - doesn't showing multiple banner ads on same activity violates the policy as stated here: http://stackoverflow.com/a/11959837/6144372 ? – Hammad Nasir Dec 14 '16 at 12:25
0

If you show more than one simultaneous ad on the Activity you are violating Admob policy.

William
  • 20,150
  • 8
  • 49
  • 91
  • even if the ads are appearing randomly in a `RecyclerView`? – Hammad Nasir Dec 14 '16 at 14:52
  • 1
    More than one ad on the screen at a time is a violation of AdMob policy. You can definitely have several ads in a RecyclerView, though, as long as they're spaced out enough that they don't appear at the same time. – RedBrogdon Dec 15 '16 at 16:23