[英]How to resolve No ad config issue in android Admob?
您好,我正在嘗試在我的應用上使用 Admob 廣告,但沒有顯示廣告。 我收到此錯誤:
"Code": 3,
"Message": "No ad config.",
"Domain": "com.google.android.gms.ads",
"Cause": "null",
"Response Info": {
"Response ID": "null",
"Mediation Adapter Class Name": "",
"Adapter Responses": []
}
測試 ID 也會出現同樣的錯誤。
這是 gradle 實現:
implementation 'com.google.firebase:firebase-ads:20.3.0'
implementation 'com.google.android.gms:play-services-ads:20.3.0'
我像這樣初始化廣告:
MobileAds.initialize(this);
這是插頁式初始化:
adRequest = new AdRequest.Builder().build();
InterstitialAd.load(c,c.getString(R.string.popup), adRequest, new InterstitialAdLoadCallback() {
@Override
public void onAdLoaded(@NonNull InterstitialAd interstitialAd) {
mInterstitialAd = interstitialAd;
}
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
mInterstitialAd = null;
}
});
謝謝@Besart,你救了我的命。 我們的一些游戲是為 12 歲以下的兒童設計的,所以我們必須展示 DFF 廣告。 以下代碼很重要:
// String MAX_AD_CONTENT_RATING_G = "G";
// String MAX_AD_CONTENT_RATING_PG = "PG";
// String MAX_AD_CONTENT_RATING_T = "T";
// String MAX_AD_CONTENT_RATING_MA = "MA";
// int TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE = 1;
// int TAG_FOR_CHILD_DIRECTED_TREATMENT_FALSE = 0;
RequestConfiguration configuration = new RequestConfiguration.Builder()
.setTagForChildDirectedTreatment(1)
.setMaxAdContentRating("G")
.build();
MobileAds.setRequestConfiguration(configuration);
但是代碼會導致測試廣告出現“無廣告配置”錯誤。 所以,如果你有,請刪除上面的代碼,希望有幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.