Skip to main content

Interstitial

Static or video ads that can be displayed at natural transition points, creating engaging brand experiences without disrupting user app usage.

Introduction

Ad format that appears when users open or switch to your application. Refer to the ad sizes supported by Hisavana ad source: 1:1, 9:16, 3:2, effect diagrams as follows:

1:19:163:2

We recommend that you download and experience the Mediation 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.

Strongly Recommended: During ad display, avoid making repeated ad requests using the same ad object. If you need to make a new ad request, please create a new ad object. Otherwise, the ad request will be invalid and an error message will be returned via the onError callback.

// Initialize interstitial ad object, where "interstitial_id" is the interstitial ad unit ID
TInterstitialAd mTInterstitialAd = new TInterstitialAd(this, "interstitial_id");
// Build ad request body
TAdRequestBody tAdRequest = new TAdRequestBody.AdRequestBodyBuild()
.setAdListener(new TAdAlliance())
.build();
// Set ad request body
mTInterstitialAd.setRequestBody(tAdRequest);
// After loading ads, return the optimal ad callback within the set waiting time
mTInterstitialAd.loadAd();

// Ad listener, monitors ad load completion (fill), display, click, exception, close actions callbacks
private static class TAdAlliance extends TAdListener {

// Load completion callback (applicable ad units: all ad units)
@Override
public void onLoad() {
// Ad loaded callback
}

// Exception callback (applicable ad units: all ad units)
@Override
public void onError(TAdErrorCode errorCode) {
// Ad failed callback
}

// Display callback (applicable ad units: Splash, Interstitial, Banner, Reward)
@Override
public void onShow(int source) {
// Ad show callback
}

// Click callback (applicable ad units: Splash, Interstitial, Banner, Reward)
@Override
public void onClicked(int source) {
// Ad click callback
}

// Close callback (applicable ad units: Splash, Interstitial, Banner, Reward)
@Override
public void onClosed(int source) {
// Ad close callback
}

// Display failure callback (applicable ad units: all ad units)
@Override
public void onShowError(TAdErrorCode errorCode) {
// Ad show failed callback
}
}

Reminder: source represents the ad source, please refer to Ad Source Correlation Table; for example: if this ad fill display is pangle ad, then source=6.

Display Ads

Please display the interstitial ad.

// Display interstitial ad
if (mTInterstitialAd != null && mTInterstitialAd.hasAd()) {
mTInterstitialAd.show(context);
}
/**
* Optional
* For applications that need to track ad scenario reach, you can set scenario values yourself
* Main purpose is to track current ad scenario utilization rate, first parameter custom scenario name, second parameter ad quantity
*/
String sceneToken = mTInterstitialAd.enterScene("interstitial_scene_name", 1);
if (mTInterstitialAd != null && mTInterstitialAd.hasAd()) {
mTInterstitialAd.show(context, sceneToken);
}

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 (mTInterstitialAd != null) {
mTInterstitialAd.destroy();
mTInterstitialAd = null;
}
}

Other APIs

API CallDescription
mTInterstitialAd.hasAd()Whether there is currently an available ad