Skip to main content

Interstitial

Static or video ads that can be displayed at natural nodes or transition points, capable of creating engaging brand experiences without interrupting the user's app experience.

Introduction​

An ad format that appears when users open or switch to your application (supports landscape mode). Supported ad sizes: 1:1, 9:16, 3:2. Effect images as follows:

1:19:163:2

We recommend that you download and experience the Hisavana SSP Demo to gain a more intuitive and in-depth understanding of the SDK's features and usage. Through the Demo, you can quickly get started and explore its application in real-world scenarios.

Loading Ads​

Please configure the corresponding parameters and callback listeners. Be sure to carefully review the documentation for the applicable ad placement types in relevant callbacks to avoid integration discrepancies.

// Initialize the interstitial ad object, where "interstitial_id" is the interstitial ad unit ID
TInterstitial mAdInterstitial = new TInterstitial("interstitial_id");
// Set the ad listener
mAdInterstitial.setListener(new TAdListener());
// Load the ad
mAdInterstitial.loadAd();

// Ad listener, monitors callbacks for ad request timeout, loading completion (fill), display, click, exception, and close actions
private static class TAdListener extends AdListener {

// Exception callback (applicable ad slots: all ad slots)
@Override
public void onError(TaErrorCode adError) {
Log.d(TAG,"Ad failed callback");
}

// Loading completion callback (applicable ad slots: Splash, Interstitial, Banner, Reward)
@Override
public void onAdLoaded() {
Log.d(TAG,"Ad loaded callback");
}

// Click callback (applicable ad slots: Splash, Interstitial, Banner, Reward)
@Override
public void onAdClicked() {
Log.d(TAG,"Ad click callback");
}

// Display callback (applicable ad slots: Splash, Interstitial, Banner, Reward)
@Override
public void onAdShow() {
Log.d(TAG,"Ad show callback");
}

// onTimeOut() is deprecated. The SDK combines the current request result with its ad cache when loading times out:
// if no usable ad is available, onError(...) is called; if a usable ad has already been obtained, including from cache,
// the load is treated as successful and onAdLoaded(...) is called instead of onError(...).
@Override
public void onTimeOut() {
Log.d(TAG,"Ad request timeout callback");
}

// Close callback (applicable ad slots: Splash, Interstitial, Reward)
@Override
public void onAdClosed() {
Log.d(TAG,"Ad close callback");
}
}

Display Ads​

Please display the interstitial ad.

// If the current ad is loaded successfully and within the delivery period, display it; otherwise, do not display it
if (mAdInterstitial != null && mAdInterstitial.isReady()) {
mAdInterstitial.show();
}

Destroy Ads​

Please recycle ads promptly, otherwise the App may experience memory leaks.

// After exiting the ad scenario, please destroy the ad object.
@Override
protected void onDestroy() {
super.onDestroy();
if (mAdInterstitial != null) {
mAdInterstitial.destroy();
mAdInterstitial = null;
}
}

Other APIs​

API CallDescription
mAdInterstitial.isReady()If the current ad is loaded successfully and within the delivery period, display it; otherwise, do not display it
mAdInterstitial.isOfflineAd()Whether the current ad is offline
mAdInterstitial.getFillAdType()Whether the current filled ad is offline or online; 1: offline ad, 0: online ad, -1: no fill
mAdInterstitial.getBidPrice()Gets the effective bid price of the ad, in cents/eCPM