There isn't much documentation on this. I was wondering, should we first call
RequestConfiguration conf= new RequestConfiguration.Builder()
.setMaxAdContentRating(
MAX_AD_CONTENT_RATING_T)
.build();
MobileAds.setRequestConfiguration(conf);
MobileAds.initialize(context, APP_ID);
Or
MobileAds.initialize(context, APP_ID);
RequestConfiguration conf= new RequestConfiguration.Builder()
.setMaxAdContentRating(
MAX_AD_CONTENT_RATING_T)
.build();
MobileAds.setRequestConfiguration(conf);
In https://developers.google.com/admob/android/quick-start
Although Google recommend calling MobileAds.initialize
as early as possible
Before loading ads, have your app initialize the Mobile Ads SDK by calling MobileAds.initialize() which initializes the SDK and calls back a completion listener once initialization is complete (or after a 30-second timeout). This needs to be done only once, ideally at app launch.
They also mention "request-specific flags" need to be set before MobileAds.initialize
.
Warning: Ads may be preloaded by the Mobile Ads SDK or mediation partner SDKs upon calling MobileAds.initialize(). If you need to obtain consent from users in the European Economic Area (EEA), set any request-specific flags (such as tagForChildDirectedTreatment or tag_for_under_age_of_consent), or otherwise take action before loading ads, ensure you do so before initializing the Mobile Ads SDK.
So, not super clear on which should be called first.
according to the official documentation
So , you should initialize
MobileAds
first ,look at the example here form the official documentation :According to Google Developer support, the following is the right way to do
https://groups.google.com/forum/#!category-topic/google-admob-ads-sdk/android/17oVu0sABjs