Hi Deepika,
Thanks for having a look. Not sure this is what you suggested, but I added an adListener and tracked how long it took for #onAdLoaded to be triggered, see below.
But in fact, I don't mind that #onAdLoaded takes a long time. I also don't mind if the first AdRequest takes an additional time to do whatever it needs. I'm only concerned that it doesn't do that on a background thread! Otherwise there will always be a jank in the UI, am I right?
My request here is if it's possible for the PublisherAdView class to remove the restriction of #loadAds being triggered on the main thread -- it's actually some method down the line -- and internally if you guys need to post something on the UI thread call the View#post(() -> {...}) or equivalent. Because there's already a listener, we can be notified when to display the advert, I just want to be able to call it from any thread.
Here's the logs for opening and closing the activity, the first 3 times since app launch:
06-29 09:04:31.677 8312-8312/com.google.android.gms.example.bannerexample D/MyActivity: #onCreate: begin
06-29 09:04:32.748 8312-8312/com.google.android.gms.example.bannerexample I/MyActivity: loadAds took: 1055ms
06-29 09:04:32.749 8312-8312/com.google.android.gms.example.bannerexample D/MyActivity: #onCreate: end
06-29 09:04:37.171 8312-8312/com.google.android.gms.example.bannerexample I/MyActivity: onAdLoaded after 5491ms
---
06-29 09:04:51.748 8312-8312/com.google.android.gms.example.bannerexample D/MyActivity: #onCreate: begin
06-29 09:04:51.870 8312-8312/com.google.android.gms.example.bannerexample I/MyActivity: loadAds took: 120ms
06-29 09:04:51.870 8312-8312/com.google.android.gms.example.bannerexample D/MyActivity: #onCreate: end
06-29 09:04:54.225 8312-8312/com.google.android.gms.example.bannerexample I/MyActivity: onAdLoaded after 2474ms
---
06-29 09:05:04.593 8312-8312/com.google.android.gms.example.bannerexample D/MyActivity: #onCreate: begin
06-29 09:05:04.787 8312-8312/com.google.android.gms.example.bannerexample I/MyActivity: loadAds took: 192ms
06-29 09:05:04.789 8312-8312/com.google.android.gms.example.bannerexample D/MyActivity: #onCreate: end
06-29 09:05:07.298 8312-8312/com.google.android.gms.example.bannerexample I/MyActivity: onAdLoaded after 2703ms
---
Thanks for taking the time!
Cheers,
Ricardo