2016-06-22 20 views
5

Tôi đang triển khai mã cho quảng cáo gốc do google cung cấp. Đó là làm việc ổn với googleKhông tải được Quảng cáo gốc: 0 Lỗi

quảng cáo đơn vị id ADMOB_AD_UNIT_ID = "ca-app-pub-3940256099942544/2247696110"

Nhưng khi tôi thay bằng id của tôi quảng cáo không hiển thị của nó và thực hiện onAdFailedToLoad phương pháp và có Không thể tải quảng cáo gốc: 0 lỗi.

I tried two different ad unit id but it didn't load ad. 

so what should I do??please help me 

tôi đã cố gắng mã dưới đây

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()); 
+1

tôi đã nhận giải pháp friends..this ADMOB_AD_UNIT_ID là dành cho expressview mẹ đẻ vì vậy nó sẽ chỉ sử dụng bởi expressview bản địa Chúng tôi không thể sử dụng cho trước xem bản địa hiện quảng cáo tự nhiên là ở dưới beta – sunita

Trả lời

0

Hãy thêm ít nhất một thiết bị kiểm tra và cố gắng, Nó có thể giúp bạn như sau,

AdRequest adRequest = new AdRequest.Builder() .addTestDevice("SEE_YOUR_LOGCAT_TO_GET_YOUR_DEVICE_ID") .build(); 
+1

Vẫn không hoạt động đối với tôi. –

0

này có thể được giải đáp gần đây nhưng mong đợi để giúp đỡ những người khác có vấn đề tương tự. Một trong những nguyên nhân chính của việc này là không chính xác kích thước

Trong trường hợp của tôi trước khi nó là

<?xml version="1.0" encoding="utf-8"?> 
<com.google.android.gms.ads.NativeExpressAdView android:id="@+id/adView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    ads:adUnitId="@string/native_ad_id" 
    ads:adSize="320x250" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/res-auto"> 
</com.google.android.gms.ads.NativeExpressAdView> 

Tôi đã nhầm lẫn khi đưa ra kích thước quảng cáo, vì vậy tôi vừa thay đổi kích thước thêm với kích thước bên dưới và được sửa. Cảm ơn.

ads:adSize="320x250" 
Các vấn đề liên quan