Prefetching Native advanced ads before displaying in Recycler View

3,081 views
Skip to first unread message

Vipul Asri

unread,
Oct 21, 2016, 7:26:23 AM10/21/16
to Google Mobile Ads SDK Developers
How to prefetch the native advanced ads, then add and display them in recycler view dynamically.

Reference:
https://firebase.google.com/docs/admob/android/native-advanced#when_to_request_ads

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
Oct 21, 2016, 10:58:38 AM10/21/16
to Google Mobile Ads SDK Developers
Hi Vipul,

We actually do have a sample app with Native Express Ad within a RecyclerView. Let us know if that helps you. You can always prefetch your ads and have a callback method to know when it's loaded and ready to be inserted. The linked sample app would be a good starting point for you to do this.

Thanks,
Arjun Busani
Mobile Ads SDK Team

Vipul Asri

unread,
Oct 23, 2016, 2:59:22 AM10/23/16
to google-adm...@googlegroups.com
Hello Arjun,

I already tried that sample app, but I want to prefetch Native Advanced Ads (beta).

--

---
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/NkGj-yqgMV8/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.

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
Oct 24, 2016, 9:53:59 AM10/24/16
to Google Mobile Ads SDK Developers
Hi Vipul,

We do not have such specific sample app, but if you have tried to build one by yourself and facing issues, you can share that with us and we can guide you with the process. 

Thanks,
Arjun Busani
Mobile Ads SDK Team

On Sunday, October 23, 2016 at 2:59:22 AM UTC-4, Vipul Asri wrote:
Hello Arjun,

I already tried that sample app, but I want to prefetch Native Advanced Ads (beta).

Vipul Asri

unread,
Oct 29, 2016, 8:20:38 AM10/29/16
to google-adm...@googlegroups.com
Hello Arjun,

I have implemented the same, Native Advanced Ads in Staggered RecyclerView (https://github.com/vipulasri/Staggered-View-Native-Advanced-Ads).

Problem: Ads rendering causes a shift in items of the view and some performance issues. Please help me in making it load in the background and as soon as ads are loaded in the background then add it to the view.

Regards,
Vipul


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.

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
Oct 31, 2016, 11:17:59 AM10/31/16
to google-adm...@googlegroups.com
Hi Vipul,

Your implementation is what I would recommend for this use case and we do not recommend ads to be loaded on the background. But you might want to cache the ads if you want to like in the attached example.

Thanks,
Arjun Busani
Mobile Ads SDK Team

On Saturday, October 29, 2016 at 8:20:38 AM UTC-4, Vipul Asri wrote:
Hello Arjun,

I have implemented the same, Native Advanced Ads in Staggered RecyclerView (https://github.com/vipulasri/Staggered-View-Native-Advanced-Ads).

Problem: Ads rendering causes a shift in items of the view and some performance issues. Please help me in making it load in the background and as soon as ads are loaded in the background then add it to the view.

Regards,
Vipul


On Mon, Oct 24, 2016 at 7:23 PM, 'Veer Arjun Busani(Mobile Ads SDK Team)' via Google Mobile Ads SDK Developers <google-admob-ads-sdk@googlegroups.com> wrote:
Hi Vipul,

We do not have such specific sample app, but if you have tried to build one by yourself and facing issues, you can share that with us and we can guide you with the process. 

Thanks,
Arjun Busani
Mobile Ads SDK Team

On Sunday, October 23, 2016 at 2:59:22 AM UTC-4, Vipul Asri wrote:
Hello Arjun,

I already tried that sample app, but I want to prefetch Native Advanced Ads (beta).
On Fri, Oct 21, 2016 at 8:28 PM, 'Veer Arjun Busani(Mobile Ads SDK Team)' via Google Mobile Ads SDK Developers <google-admob-ads-sdk@googlegroups.com> wrote:
Hi Vipul,

We actually do have a sample app with Native Express Ad within a RecyclerView. Let us know if that helps you. You can always prefetch your ads and have a callback method to know when it's loaded and ready to be inserted. The linked sample app would be a good starting point for you to do this.

Thanks,
Arjun Busani
Mobile Ads SDK Team

On Friday, October 21, 2016 at 7:26:23 AM UTC-4, Vipul Asri wrote:
How to prefetch the native advanced ads, then add and display them in recycler view dynamically.

Reference:
https://firebase.google.com/docs/admob/android/native-advanced#when_to_request_ads

--

---
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/NkGj-yqgMV8/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.
RecyclerViewAdsTest4-insert_ads.zip

Vipul Asri

unread,
Oct 31, 2016, 11:26:23 AM10/31/16
to google-adm...@googlegroups.com

Hello Arjun,

Can you tell me how to cache ads so that they that change less frequently. As in recyclerview the view out of screen are recycled which causes redraw of view, thus resulting in new ads each time.

Regards,
Vipul Asri


On 31-Oct-2016 8:48 PM, "'Veer Arjun Busani(Mobile Ads SDK Team)' via Google Mobile Ads SDK Developers" <google-adm...@googlegroups.com> wrote:
Hi Vipul,

Your implementation is what I would recommend for this use case and we do not recommend ads to be loaded on the background. But you might want to cache the ads if you want to like in this example.
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.

--

---
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/NkGj-yqgMV8/unsubscribe.
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.

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
Oct 31, 2016, 4:46:54 PM10/31/16
to Google Mobile Ads SDK Developers
Hi Vipul,

This is really up to you. While we do not have any such guidelines, Native Ads have no refresh rates. That means you can cache the response from the very first Ad Request and show it all the time if you want to. As to how you can reuse the cached ad, you can check the attached app in the previous response.

Thanks,
Arjun Busani
Mobile Ads SDK Team

On Monday, October 31, 2016 at 11:26:23 AM UTC-4, Vipul Asri wrote:

Hello Arjun,

Can you tell me how to cache ads so that they that change less frequently. As in recyclerview the view out of screen are recycled which causes redraw of view, thus resulting in new ads each time.

Regards,
Vipul Asri

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.

--

---
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/NkGj-yqgMV8/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.

Minas Mina

unread,
Feb 21, 2017, 4:56:20 PM2/21/17
to Google Mobile Ads SDK Developers
Hello.

I had the same problem and solved it by caching the ads.

I wrote a blog post about it. Please check it out and see if it solves the problem for you as well.

http://minas-mina.com/2017/02/21/preload-admob-ads-in-recyclerview/
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-adm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--

---
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/NkGj-yqgMV8/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-adm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--

---
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/NkGj-yqgMV8/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-adm...@googlegroups.com.

Vitaliy Suprun

unread,
Sep 13, 2017, 5:20:14 AM9/13/17
to Google Mobile Ads SDK Developers
we do not recommend ads to be loaded on the background
It is definitelly not good idea to do any time-consuming work on main thread.
`NativeExpressAdView.loadAd` takes too much time on main thread. It ruins smooth scrolling.
You don't need to have `loadAd` method to be called on main thread.
If you need access to main thread, you can always do `new Handler(Looper.getMainLooper()).post(new Runnable() {.....}) to do some job on main thread.
All other job shouldn't be done on main thread.
As for now, `NativeExpressAdView.loadAd` is junk. It should not work that way.

понедельник, 31 октября 2016 г., 18:17:59 UTC+3 пользователь Veer Arjun Busani(Mobile Ads SDK Team) написал:
To post to this group, send email to google-adm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--

---
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/NkGj-yqgMV8/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-adm...@googlegroups.com.

Deepika Uragayala- MobileAds SDK team

unread,
Sep 13, 2017, 2:45:06 PM9/13/17
to Google Mobile Ads SDK Developers
Hi there,

The loadAd method is actually performed on a background thread only and you do not need to explicitly add it to a background thread.

Regards,
Deepika Uragayala
Mobile Ads SDK Team

Vitaliy Suprun

unread,
Sep 14, 2017, 5:06:45 AM9/14/17
to Google Mobile Ads SDK Developers
Hello Deepika.
I did some tests on my Samsung S4 Active.
Calling `NativeExpressAdView.loadAd` takes 22 to 323 ms on main thead (just loadAd call) with average = 70 ms.
That is definitelly too much job for main thread.
Skipping a single frame (16 ms) when scrolling makes scrolling not smooth. skipping 4 or even 20 frames -- makes android app look bad.
Android team makes great job to make android animations better and smoother. Don't ruin their job.

Hammad Tariq

unread,
Dec 21, 2017, 4:44:18 AM12/21/17
to Google Mobile Ads SDK Developers
Hi Firebase Native Express AdView discussed before is deprecated now. You have to use Firebase Advanced Ads SDK. 

Anjaneya Ruthvik

unread,
Feb 14, 2018, 4:25:48 AM2/14/18
to Google Mobile Ads SDK Developers
Hello Team,

I have different Ad placements in my application and I want to pref-etch the Ads and have a buffer of them. So, that if a requested Ad is not displayed I could display it at some other place. I just want to know if this approach is correct and I also heard that after requesting an Ad there's a time frame by which  we should display the Ad. If so can you please let me know the time frame for ads to be displayed for Admob Native Advanced.

Thanks,
Ruthvik

mobileadssdk-a...@google.com

unread,
Feb 14, 2018, 3:00:50 PM2/14/18
to Anjaneya Ruthvik, Google Mobile Ads SDK Developers
Hi Ruthvik, 

You will be able to prefetch ads and this would not be any issue. You can even prefetch multiple ads with the same AdRequest using the loadAds() method. Let us know if you need anything else. But we would suggest that you limit the number of ads that you can request to as least as possible.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/ec7b9761-f3d4-4e7f-b215-94ff57e4f579%40googlegroups.com.

mobileadssdk-a...@google.com

unread,
Feb 14, 2018, 4:53:54 PM2/14/18
to Anjaneya Ruthvik, Google Mobile Ads SDK Developers
Hi there,

For your questions which you asked via private email, I'll reply here so that it will be useful for the community members and here is your question-

Thanks for the prompt response. Can you please let me know if there's any time limit for the request ad to be displayed. 

The frequency at which you are making your ad requests depends on your use case. There's never a limit on when and how to request ads. 

It would be a great help if you could provide me any sample app that has recycler view showing native advanced ads.
While we do not have a sample app with RecyclerView and Native Advanced ad, we have a deprecated sample app with ListView and Native Advanced. I will update the thread if I can find a copy of the old sample app and post it here as well. 

Regards,
Deepika Uragayala
Mobile Ads SDK Team



=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

On 02/14/18 15:00:23 mobileadssdk-a...@google.com wrote:
Hi Ruthvik, 

You will be able to prefetch ads and this would not be any issue. You can even prefetch multiple ads with the same AdRequest using the loadAds() method. Let us know if you need anything else. But we would suggest that you limit the number of ads that you can request to as least as possible.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

On 02/14/18 04:25:47 ruthv...@gmail.com wrote:
Hello Team,

I have different Ad placements in my application and I want to pref-etch the Ads and have a buffer of them. So, that if a requested Ad is not displayed I could display it at some other place. I just want to know if this approach is correct and I also heard that after requesting an Ad there's a time frame by which  we should display the Ad. If so can you please let me know the time frame for ads to be displayed for Admob Native Advanced.

Thanks,
Ruthvik

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsubscrib...@googlegroups.com.

mobileadssdk-a...@google.com

unread,
Feb 15, 2018, 11:52:13 AM2/15/18
to Anjaneya Ruthvik, Google Mobile Ads SDK Developers
Hi Ruthvik,

For Banner Ads, there is no time limit as long as you have a valid reference. As for Interstitials, you need to check with the isReady() method to see if the received reference is still valid and then show it to the user.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

On 02/14/18 16:53:37 mobileadssdk-a...@google.com wrote:
Hi there,

For your questions which you asked via private email, I'll reply here so that it will be useful for the community members and here is your question-

Thanks for the prompt response. Can you please let me know if there's any time limit for the request ad to be displayed. 

The frequency at which you are making your ad requests depends on your use case. There's never a limit on when and how to request ads. 

It would be a great help if you could provide me any sample app that has recycler view showing native advanced ads.
While we do not have a sample app with RecyclerView and Native Advanced ad, we have a deprecated sample app with ListView and Native Advanced. I will update the thread if I can find a copy of the old sample app and post it here as well. 

Regards,
Deepika Uragayala
Mobile Ads SDK Team



=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Eric Leichtenschlag (Mobile Ads SDK Team)

unread,
May 4, 2018, 12:31:37 AM5/4/18
to Google Mobile Ads SDK Developers
Hi Ruthvik,

If you've cahced an ad for 30 minutes and still haven't shown it, we recommend loading a fresh one.

Thanks,
Eric, Mobile Ads SDK Team

On Thursday, February 15, 2018 at 11:52:13 AM UTC-5, mobileadssdk-a...@google.com wrote:
Hi Ruthvik,

For Banner Ads, there is no time limit as long as you have a valid reference. As for Interstitials, you need to check with the isReady() method to see if the received reference is still valid and then show it to the user.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Reply all
Reply to author
Forward
0 new messages