简体   繁体   English

Admob原始广告无法加载错误代码0

[英]Admob Native ads failed to load with error code 0

NativeExpressAdView adView = (NativeExpressAdView) findViewById(R.id.adView);
         adView.loadAd(new AdRequest.Builder().build());

NativeExpressAdView is working fine but

AdLoader.Builder builder = new AdLoader.Builder(con, ADMOB_AD_UNIT_ID);

/*if (requestAppInstallAds)*/ {
    builder.forAppInstallAd(new NativeAppInstallAd.OnAppInstallAdLoadedListener() {
        @Override
        public void onAppInstallAdLoaded(NativeAppInstallAd ad) {
            //FrameLayout frameLayout =(FrameLayout) findViewById(R.id.fl_adplaceholder);
            // NativeAppInstallAdView adView = (NativeAppInstallAdView) getLayoutInflater().inflate(R.layout.ad_app_install, null);

        }
    });
}


    adLoader = builder.withAdListener(new AdListener() {
        @Override
        public void onAdFailedToLoad(int errorCode) {
            Toast.makeText(con, "Failed to load native ad: "
                    + errorCode, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onAdClosed() {
            super.onAdClosed();

        }
    }).build();


    //adLoader.loadAd(new AdRequest.Builder().addTestDevice("9221FAA48B3F9AD9AA72601953B89E76").build());
    adLoader.loadAd(new AdRequest.Builder().build());

works fine with test ads if use live ads id its show failed to load error code 0 Why? 如果使用实时广告ID,测试广告可以正常使用它的节目无法加载错误代码0为什么?

NativeExpressAdView is only available now. NativeExpressAdView现在才可用。 you can request for native through this link https://support.google.com/admob/contact/account_setup?rd=1 您可以通过此链接申请原生https://support.google.com/admob/contact/account_setup?rd=1

Not every ad request produces ads. 并非每个广告请求都会产生广告 Especially if you're just testing, in that case you explicitly have to add your device id as test device otherwise you wont get ads. 特别是如果您只是进行测试,那么您明确必须将设备ID添加为测试设备,否则您将无法获得广告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM