Is there any problem in showing an ad of same 'Ad unit ID' multiple times in the same activity?

474 views
Skip to first unread message

Hammad Nasir

unread,
Dec 14, 2016, 7:23:55 AM12/14/16
to Google Mobile Ads SDK Developers

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.

Vu Chau (Mobile Ads SDK Team)

unread,
Dec 14, 2016, 10:02:16 AM12/14/16
to Google Mobile Ads SDK Developers
Hello,

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.

Vu Chau
Mobile Ads SDK Team

Hammad Nasir

unread,
Dec 14, 2016, 10:10:23 AM12/14/16
to google-adm...@googlegroups.com
Whoa!

I really appreciate this quick reply from you. This is a sigh of relief! Thanks, Vu Chau!

So, do you mean that I can continue with my above written code which shows the same ads(ads with same Ad unit ID) at random positions in a RecyclerView? And I'll not be banned or anything from using google admob with this account?

I'd really appreciate it if you could reply me about above questions and also let me know that how this above practice would effect the revenue generation?

Thanks again.
Hammad Nasir

--

---
You received this message because you are subscribed to a topic in the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-admob-ads-sdk/eBc6ar3ULa0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vu Chau (Mobile Ads SDK Team)

unread,
Dec 14, 2016, 10:27:05 AM12/14/16
to Google Mobile Ads SDK Developers
Hi Hammad,

Yes, that is absolutely correct. You are fine using the same ad unit ID for all your native express ads in the RecyclerView. Adding your NativeExpressAdView in any order (sequential or random) is fine. We do it sequentially here.

As far as revenue is concerned, that is determined by how fast/slow your users will be scrolling through the list. The more ads shown, the more revenue generated. Having said that, you can preload your native express ads, so when the time comes for showing them, they can quickly be shown and register impressions immediately. This way, you will not have to wait for the new ad request to execute.

Vu Chau
Mobile Ads SDK Team

On Wednesday, December 14, 2016 at 10:10:23 AM UTC-5, Hammad Nasir wrote:
Whoa!

I really appreciate this quick reply from you. This is a sigh of relief! Thanks, Vu Chau!

So, do you mean that I can continue with my above written code which shows the same ads(ads with same Ad unit ID) at random positions in a RecyclerView? And I'll not be banned or anything from using google admob with this account?

I'd really appreciate it if you could reply me about above questions and also let me know that how this above practice would effect the revenue generation?

Thanks again.
Hammad Nasir

Hammad Nasir

unread,
Dec 14, 2016, 10:32:52 AM12/14/16
to google-adm...@googlegroups.com
Oh! You are a great man!

Thanks a ton, dude! Thanks a TON!

Peace!
Hammad Nasir

To unsubscribe from this group and all its topics, send an email to google-admob-ads-sdk+unsubscrib...@googlegroups.com.

To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages