这方面的文档不多。我在想,我们是不是该先打个电话
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中
尽管谷歌建议尽早给MobileAds.initialize
打电话
在加载ads之前,让应用程序通过调用MobileAds.initialize()来初始化Mobile,后者初始化SDK并在初始化完成后(或30秒超时后)调用一个完成监听器。这只需要做一次,最好是在应用程序的启动。
他们还提到需要在MobileAds.initialize
之前设置“特定请求的标志”。
警告:在调用MobileAds.initialize()时,移动Ads或中介合作伙伴SDK可能会预加载Ads。如果您需要获得欧洲经济区(EEA)用户的同意,设置任何特定于请求的标志(如tagForChildDirectedTreatment或tag_for_under_age_of_consent),或者在加载ads之前采取其他措施,请确保在初始化Mobile之前这样做。
所以,对于哪个应该被称为第一个还不太清楚。
发布于 2021-07-08 03:17:51
它是这样完成的:
MobileAds.RequestConfiguration =
new RequestConfiguration
.Builder()
.SetTagForChildDirectedTreatment(RequestConfiguration.TagForChildDirectedTreatmentTrue)
.SetMaxAdContentRating(RequestConfiguration.MaxAdContentRatingG)
#if DEBUG
.SetTestDeviceIds(new[] { "..." })
#endif
.Build();
https://stackoverflow.com/questions/58084706
复制相似问题