I am implementing the code for native ads provided by google. This works fine google
ad unit ID ADMOB_AD_UNIT_ID = "ca-app-pub-3940256099942544/2247696110"
But when I replace my identifier, it wonβt show the ad and execute the onAdFailedToLoad method and it didnβt receive. Unable to load own ad: error 0 .
I tried two different ad unit id but it didn't load ad. so what should I do??please help me
I tried under the code
final LayoutInflater li = (LayoutInflater) appContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); AdLoader.Builder builder = new AdLoader.Builder(appContext, Global.ADMOB_AD_UNIT_ID); builder.forContentAd(new NativeContentAd.OnContentAdLoadedListener() { @Override public void onContentAdLoaded(NativeContentAd ad) { //viewHolder.rlnativead.setVisibility(View.VISIBLE); NativeContentAdView adView = (NativeContentAdView)li .inflate(R.layout.ad_content, null); populateContentAdView(ad, adView); viewHolder.fl_adplaceholder.removeAllViews(); viewHolder.fl_adplaceholder.addView(adView); } }); AdLoader adLoader = builder.withAdListener(new AdListener() { @Override public void onAdFailedToLoad(int errorCode) { // Toast.makeText(appContext, "Failed to load native ad: " // + errorCode, Toast.LENGTH_SHORT).show(); Log.e("Call List adapter","Failed to load native ad: "+errorCode); } }).build(); adLoader.loadAd(new AdRequest.Builder().build());
source share