我们应该先调用MobileAds.setRequestConfiguration还是MobileAds.initialize吗? [英] Should we first call MobileAds.setRequestConfiguration or MobileAds.initialize?
问题描述
关于此的文档不多。我想知道,是否应该先调用
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);
或
MobileAds.initialize(context, APP_ID);
RequestConfiguration conf= new RequestConfiguration.Builder()
.setMaxAdContentRating(
MAX_AD_CONTENT_RATING_T)
.build();
MobileAds.setRequestConfiguration(conf);
在 https://developers.google.com/admob/android/quick-start
尽管Google建议尽快调用 MobileAds.initialize
Although Google recommend calling MobileAds.initialize
as early as possible
在加载广告之前,让您的应用通过
调用MobileAds.initialize()来初始化Mobile Ads SDK,该工具将初始化SDK,并在初始化完成后(或在$ b $之后)调用
返回完成监听器b 30秒超时)。只需执行一次,最好在应用程序
启动时完成。
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.
他们还提到特定于请求的标志的需要可以在 MobileAds.initialize
之前进行设置。
They also mention "request-specific flags" need to be set before MobileAds.initialize
.
警告:广告可能会预先加载调用MobileAds.initialize()时,移动广告SDK或中介
合作伙伴SDK。如果您需要
获得欧洲经济区(EEA)用户的同意,请设置任何
特定于请求的标志(例如tagForChildDirectedTreatment或
tag_for_under_age_of_consent),或者在加载$之前采取其他措施b $ b广告,请确保在初始化Mobile Ads SDK之前先这样做。
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.
推荐答案
根据Google Developer支持,以下是正确的方法
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
RequestConfiguration conf= new RequestConfiguration.Builder()
.setMaxAdContentRating(
MAX_AD_CONTENT_RATING_T)
.build();
MobileAds.setRequestConfiguration(conf);
MobileAds.initialize(context, APP_ID);
这篇关于我们应该先调用MobileAds.setRequestConfiguration还是MobileAds.initialize吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!