1
什麼是錯誤?因爲admob interstital廣告不會顯示?由於Admob插頁式廣告不會顯示?
public class MainActivity extends Activity implements AdListener {
private InterstitialAd interstitial;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Create the interstitial
interstitial = new InterstitialAd(this, "ca-app-pub-6xxxxxxxx/xxxxxx");
// Create ad request
AdRequest adRequest = new AdRequest();
// Begin loading your interstitial
interstitial.loadAd(adRequest);
// Set Ad Listener to use the callbacks below
interstitial.setAdListener(this);
}
public void onReceiveAd(Ad ad) {
// TODO Auto-generated method stub
Log.d("ads", "onReceiveAd");
if (ad == interstitial)
interstitial.show();
}
謝謝,我不知道,因爲將不顯示
我必須插入什麼MY_AD_UNIT_ID? – AnonymousDoor
是的,你必須添加您的插入MY_AD_UNIT_ID像「ca-app-pub-6xxxxxxxx/xxxxxx」 –
謝謝,但是當我插入此代碼的廣告我的應用程序不打開 – AnonymousDoor