如何在应用退出时展示AdMob插页式广告。
我尝试使用onBackPressed()方法实现,但是出现了错误。
插页式广告的代码:
interstitial = new InterstitialAd(this, "AD_ID");
AdRequest adRequest = new AdRequest();
interstitial.loadAd(adRequest);
interstitial.setAdListener(this);
}
@Override
public void onReceiveAd(Ad ad) {
if (ad == interstitial) {
interstitial.show();
}
}
正确的做法是什么?