1

Loading admob ads makes the app startup really laggy, it looks like admob uses WKWebview which runs on the UI thread.

Is it ok if i fetch (fetch data without displaying them) the ads in the background and keep them in memory so that when the app starts up or comes to foreground it doesn't lag? Are there any guidelines against this?

My users generally visit the app every 2-3 hours, so there is a good chance the app is not killed and the ads remain in memory for future use

aryaxt
  • 76,198
  • 92
  • 293
  • 442

1 Answers1

0

https://developers.google.com/admob/android/banner#load_an_ad

Please refer to this statement Note: Make all calls to the Mobile Ads SDK on the main thread.

Also refer to this link https://groups.google.com/g/google-admob-ads-sdk/c/NBpj7fy7wYc

Hi everyone,

Below are my responses to your concerns:

    I am having the same issue with my app, this MobileAds.initialize() method, when used as prescribed, is responsible for a huge part of my app startup time.  A median of 405ms and a p95 of 1.5 seconds.


It is important to note that initializing the SDK using the MobileAds.initialize() method is optional. Also, if you decided not to call this method, the SDK will be initialized automatically on your very first Ad request which might increase the Ads load time to a few milliseconds more, similar to what Minas have observed. That said, you should be able to load Ads with or without implementing the MobileAds.initialize() as it is mainly for the purpose of initializing the SDK ahead to decrease load time on the first Ad request.

     Is it safe to run the MobileAds.initialize() method on a background thread instead of running it on the main UI thread?


Please note that according to this guide, all calls to the Mobile Ads SDK such as the MobileAds.initialize() should be executed on the main thread and not in the background thread.

Regards,
Steven Balan
Mobile Ads SDK Team
Amod Gokhale
  • 2,346
  • 4
  • 17
  • 32