Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Initialize Google Mobile Ads SDK (Admob) only once?

if we need to initialise Admob SDK then should we initialise it for once at MainActivity.class or there's need to initialise it in every activity in which Admob Ads are present?

As per this link : https://firebase.google.com/docs/admob/android/quick-start "To initialize the Google Mobile Ads SDK at app launch, call MobileAds.initialize() in the onCreate() method of the MainActivity class."

So should we call it only once for every Ads in different activity?

like image 303
Abhinandan Chakraborty Avatar asked Nov 25 '16 15:11

Abhinandan Chakraborty


2 Answers

The best place to initialize the Ads SDK is from the onCreate method of your Application. If you don't have an Application class yet, I recommend your create one.

like image 166
William Avatar answered Nov 09 '22 08:11

William


Your app only needs to call that method once, typically at startup in the first activity. There's no need to call it twice during a single execution of the app, or in every single activity.

See the official reference docs for details.

like image 36
RedBrogdon Avatar answered Nov 09 '22 07:11

RedBrogdon