PublisherAdView.loadAd() blocks main thread on first load *only*

1,899 views
Skip to first unread message

Lisa Wray

unread,
Oct 25, 2016, 10:40:27 AM10/25/16
to Google Mobile Ads SDK Developers
Hi,

We're seeing a delayed load on the very first time we load a PublisherAdView.  The delay blocks the main thread and is usually between 300ms-1000ms.  Following ad loads are usually less than 20ms.

We can reproduce this delay every time on fresh app launch.

In TraceView, here's the top method:


If I continue clicking on the parent method, after four clicks I get to:


We're using com.google.android.gms.ads.doubleclick.PublisherAdView and the version is 9.6.1.

I'm happy to send over a full trace as well if that would be helpful.


Lisa Wray

unread,
Oct 25, 2016, 12:03:21 PM10/25/16
to Google Mobile Ads SDK Developers
Here is a minimal sample project which shows a single ad load and displays a Snackbar showing how long the ad load took.
https://drive.google.com/file/d/0B9oLlyS_KCW1VURCQ3hNdnNKUGM/view?usp=sharing

On a Samsung S6, I've never seen the initial load take less than 300ms.  Please make sure to swipe the application away in Recent Apps between tests; if you leave the app running in the background between tests, the ad loading is fine.

Vu Chau (Mobile Ads SDK Team)

unread,
Oct 25, 2016, 3:36:05 PM10/25/16
to Google Mobile Ads SDK Developers
Hi Lisa,

Appreciated the trace results and the sample project. I checked with the SDK team, and we confirmed that the first ad load will always have this latency. This is the result of the SDK loading code from Google Play services, which corresponds to the dalvik methods shown in the trace files. 

Our recommendation is to call MobileAds.initialize early on in the app to force some of this class loading to happen sooner.

Cheers,

Vu Chau
Mobile Ads SDK Team

Lisa Wray

unread,
Oct 25, 2016, 4:28:10 PM10/25/16
to google-adm...@googlegroups.com

Aha so there is an initialize method!  Thanks, we'll see where we can put it.


--

---
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/91AxN2Q9Znk/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.
Reply all
Reply to author
Forward
0 new messages