(EN) Android Interstitial - adxcorp/ADXLibrary_Integration GitHub Wiki
Interstitial Integration
1) Layout
You do not need to provide a layout for Interstitial Ads
2) Loading, showing and destroying Interstitial Ads
Add InterstitialAdListener
to MoPubInterstitial
and load Interstitial Ads.
Once the ad has been loaded successfully, onInterstitialLoaded
callback will get called and then you can show the ad.
public class InterstitialActivity extends AppCompatActivity {
private MoPubInterstitial mMoPubInterstitial;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mMoPubInterstitial = new MoPubInterstitial(this, DefineAdUnitId.INTERSTITIAL_AD_UNIT_ID);
mMoPubInterstitial.setInterstitialAdListener(new MoPubInterstitial.InterstitialAdListener() {
@Override
public void onInterstitialLoaded(MoPubInterstitial interstitial) {
// If you want to show when loaded interstitial
mMoPubInterstitial.show();
}
@Override
public void onInterstitialFailed(MoPubInterstitial interstitial, MoPubErrorCode errorCode) {
}
@Override
public void onInterstitialShown(MoPubInterstitial interstitial) {
}
@Override
public void onInterstitialClicked(MoPubInterstitial interstitial) {
}
@Override
public void onInterstitialDismissed(MoPubInterstitial interstitial) {
}
});
mMoPubInterstitial.load();
}
@Override
protected void onDestroy() {
super.onDestroy();
mMoPubInterstitial.destroy();
}
}