Interstitial - uc-union/union-ads-sdk-demo GitHub Wiki

Integration Guide

Note: Be sure that SDK is initialzed correctly, see Initialize SDK.

Interstitial ad is displayed in the form of an inserted UI (half screen dialog box or full-screen UI).

Example codes are listed below, for a complete example please refer to InterstitialFragment.java

final InterstitialAd interstitial = new InterstitialAd(MainActivity.this);  
interstitial.setAdListener(new AdListener() {
    @Override
    public void onAdLoaded(Ad ad) {
        interstitial.show();
    }
    @Override
    public void onAdClosed(Ad ad) {
    }
    @Override
    public void onAdShowed(Ad ad) {
    }
    @Override
    public void onAdClicked(Ad ad) {
    }
    @Override
    public void onAdError(Ad ad, AdError adError) {
    }
});
AdRequest adRequest = AdRequest.newBuilder()
        .pub(<Pub>)
        .build();
interstitial.loadAd(adRequest);

NOTE:

  1. You should invoke show() of InterstitialAd when onAdLoaded is called back, or Interstitial will not show correctly
  1. <Pub> is a unique id for the ad placement, please get it from uc union manager console or your BD

DEMO

Once you run the demo project and show the interstitial ad, you should see something like this:

interstitial-example

Next Steps

  • Follow our guide on Native Ads to add native ads in your app.

  • See FAQ to know about the frequently asked questions.

  • See API reference to explore all APIs in Union Ad SDK.

⚠️ **GitHub.com Fallback** ⚠️