Skip to content

Interstitial Ads

Interstitial ads are full-screen or full-page ads that temporarily cover an app’s interface. They’re typically shown at natural pauses or transition points—such as after completing a level in a game or when navigating between major views.

This guide shows you how to integrate interstitial ads into an your app.

Load ad

Create an instance of CTInterstitial, passing in the placementId and calling the loadAd method.

java

CTAdRequest adRequest = new CTAdRequest.Builder()
    .setPlacementId("INTERSTITIAL_PLACEMENT_ID")// [necessary] placementId from carty publisher
    .setMute(true)// [optional] does video ads mute play, sdk default value true
    .build();
CTInterstitial ctInterstitial = new CTInterstitial(adRequest);
ctInterstitial.loadAd();
kotlin

val adRequest = CTAdRequest.Builder()
    .setPlacementId("INTERSTITIAL_PLACEMENT_ID")// [necessary] placementId from carty publisher
    .setMute(true)// [optional] does video ads mute play, sdk default value true
    .build()
val ctInterstitial = CTInterstitial(adRequest)
ctInterstitial.loadAd()

Register Listener

It is recommended to register a listener before calling the CTInterstitial.loadAd method.

java

ctInterstitial.setInterstitialAdListener(new CTInterstitialAdListener() {
    @Override
    public void onLoaded(CTBaseAd baseAd) {
    }

    @Override
    public void onLoadFailed(CTAdError adError) {
    }

    @Override
    public void onShown(CTBaseAd baseAd) {
    }

    @Override
    public void onShowFailed(CTBaseAd baseAd, CTAdError adError) {
    }

    @Override
    public void onClicked(CTBaseAd baseAd) {
    }

    @Override
    public void onClosed(CTBaseAd baseAd) {
    }
});
kotlin

ctInterstitial.setInterstitialAdListener(object : CTInterstitialAdListener {
    override fun onLoaded(baseAd: CTBaseAd?) {
    }

    override fun onLoadFailed(adError: CTAdError?) {
    }

    override fun onShown(baseAd: CTBaseAd?) {
    }

    override fun onShowFailed(baseAd: CTBaseAd?, adError: CTAdError?) {
    }

    override fun onClicked(baseAd: CTBaseAd?) {
    }

    override fun onClosed(baseAd: CTBaseAd?) {
    }
})

Make sure ad ready

Before you showAd, you need to check if the ad is ready.

java

ctInterstitial.isReady();
kotlin

ctInterstitial.isReady()

Display ad

Call showAd on the CTInterstitial object that you instantiated

java

ctInterstitial.showAd(activity);
kotlin

ctInterstitial.showAd(activity)

Client-side bidding

After the ad loads successfully, you can obtain ecpm by calling CTBaseAd.getEcpm

java

baseAd.getEcpm();
kotlin

baseAd.ecpm

After winning the ad bid, call onC2SBiddingSuccess and pass in the second-highest bid from this bid.

java

ctInterstitial.onC2SBiddingSuccess("secondPrice", null);
kotlin

ctInterstitial.onC2SBiddingSuccess("$secondPrice", null)

After an ad is lost, onC2SBiddingFailed is called with the highest bid received in the auction.

java

ctInterstitial.onC2SBiddingFailed("topPrice", null);
kotlin

ctInterstitial.onC2SBiddingFailed("$topPrice", null)

Examples on GitHub