2014-11-04 80 views
0

我有間質性廣告,但不會調用加載方法它給出的logcat以下警告:Intersitial廣告不加載Android?

11-04 09:32:02.046: I/Ads(29747): No fill from ad server. 
11-04 09:32:02.066: W/Ads(29747): Failed to load ad: 3 

我的橫幅廣告加載但插頁廣告失敗。

下面的代碼這被寫:

AdRequest adRequest1 = new AdRequest.Builder().build(); 
InterstitialAd interstitial = new InterstitialAd(this); 
interstitial.setAdUnitId(AD_UNIT_ID); 
interstitial.loadAd(adRequest1); 
interstitial.setAdListener(new AdListener() { 
    @Override 
    public void onAdLoaded() { 
     // TODO Auto-generated method stub 
     // super.onAdLoaded(); 
     interstitial.show(); 
    } 
}); 

幫助

+0

從廣告服務器無填充..這個誤差是從他們身邊..目前還沒有廣告在他們的分貝。你是否已經在xml中的代碼中正確聲明瞭單元ID?嘗試清理並重新安裝應用程序 – Naufal 2014-11-04 04:44:13

+0

是adUnitId是正確的橫幅廣告使用相同的ID工作正常,但對於interstial廣告不加載 – virendrao 2014-11-04 04:46:33

+0

你檢查此鏈接https://developers.google.com/mobile-ads-sdk/docs/ admob/android/interstitial – Naufal 2014-11-04 04:47:19

回答

0

是解決辦法是,你需要不同的廣告單元ID的橫幅和插頁廣告。對於測試設備,可以使用其中一個,但對於生產,您需要使用不同的廣告單元ID。

Link解決方案。

-1

這是我的間質性廣告例如只需要折射任何你想要的代碼:

public class InterstitialsAdsExampleActivity extends Activity implements 
     AdListener { 
    /** Called when the activity is first created. */ 
    private InterstitialAd interstitialAds = null; 
    private TextView textView = null; 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 

     this.interstitialAds = new InterstitialAd(this,"your ad-id here"); 
     this.interstitialAds.setAdListener(this); 

     Button loadButton = (Button) this.findViewById(R.id.loadButton); 
     loadButton.setOnClickListener(loadButtonOnClick); 

     this.textView = (TextView) this.findViewById(R.id.stateTextView); 
    } 

    private OnClickListener loadButtonOnClick = new OnClickListener() { 

     @Override 
     public void onClick(View v) { 
      // TODO Auto-generated method stub 
      textView.setText("Loading Intertitial Ads"); 

      AdRequest adr = new AdRequest(); 
      // add your test device here 
      //adr.addTestDevice("your test device id here"); 
      interstitialAds.loadAd(adr); 
     } 
    }; 

    @Override 
    public void onDismissScreen(Ad arg0) { 
     // TODO Auto-generated method stub 

    } 

    @Override 
    public void onFailedToReceiveAd(Ad ad, ErrorCode error) { 
     String message = "Load Ads Failed: (" + error + ")"; 
     textView.setText(message); 
    } 

    @Override 
    public void onLeaveApplication(Ad arg0) { 
     // TODO Auto-generated method stub 
    } 

    /** 
    * Called when an Activity is created in front of the app (e.g. an 
    * interstitial is shown, or an ad is clicked and launches a new Activity). 
    */ 
    @Override 
    public void onPresentScreen(Ad arg0) { 
     // TODO Auto-generated method stub 
    } 

    @Override 
    public void onReceiveAd(Ad arg0) { 
     if (interstitialAds.isReady()) { 
      interstitialAds.show(); 
     } else { 
      textView.setText("Interstitial ad was not ready to be shown."); 
     } 
    } 
}