简体   繁体   中英

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?

NativeExpressAdView is only available now. you can request for native through this link 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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