Splash
A special ad format that displays when the app performs a warm start or cold start.
Overview
An ad format that appears at natural endpoints and transitions. Refer to the Hisavana SSP ad source for the supported size 9:20. Sample preview:
| 9:20 |
|---|
![]() |
We recommend downloading and trying the Mediation Demo to get a more intuitive and in-depth understanding of the SDK's features and usage.
Build the Component
Add TSplashView in the XML layout.
Reminder: For Hisavana SSP SPLASH_VIEW mode and Mintegral splash, you must add the View in XML. For all other cases, adding the View at show time is sufficient.
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.hisavana.mediation.ad.TSplashView
android:id="@+id/splash_ad"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Load Ad
Set the required parameters and listener callbacks. Pay close attention to which ad unit types each callback applies to, to avoid integration errors.
Strongly recommended:
- Avoid making a new ad request using the same ad object while an ad is being displayed. If you need to make a new request, create a new ad object. Otherwise the request will be invalid and an error will be returned via the onError callback.
- Some ad sources may occasionally skip the onAdShowError callback. Apps that rely on this callback for navigation logic may get stuck on the splash screen. To avoid this, add a timeout mechanism on the splash page. For example, navigate to the next screen automatically if the splash ad has not displayed within approximately 3 seconds.
// Bind the splash ad view
TSplashView tSplashView = findViewById(R.id.splash_ad);
// "splash_id" is the splash ad unit ID
TSplashAd tSplashAd = new TSplashAd(this, "splash_id");
// Build and set the ad request body
tSplashAd.setRequestBody(
new TAdRequestBody.AdRequestBodyBuild()
.setAdListener(new TAdAlliance())
.build());
// Listen for skip actions
tSplashAd.setOnSkipListener(new TOnSkipListener());
// Load the ad and return the optimal ad within the configured wait time
tSplashAd.loadAd();
// Example: timeout mechanism
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
// Execute navigation logic
}
}, 3000);
// Splash skip action listener
private class TOnSkipListener implements OnSkipListener {
@Override
public void onClick() {
// Close the current page
finish();
}
@Override
public void onTimeReach() {
// Countdown ended
}
}
// Ad listener — callbacks for load, show, click, error, and close events
private static class TAdAlliance extends TAdListener {
// Load callback (applicable to: all ad units)
@Override
public void onLoad() {
// Ad loaded callback
}
// Error callback (applicable to: all ad units)
@Override
public void onError(TAdErrorCode errorCode) {
// Ad failed callback
}
// Show callback (applicable to: Splash, Interstitial, Banner, Reward)
@Override
public void onShow(int source) {
// Ad show callback
}
// Click callback (applicable to: Splash, Interstitial, Banner, Reward)
@Override
public void onClicked(int source) {
// Ad click callback
}
// Close callback (applicable to: Splash, Interstitial, Banner, Reward)
@Override
public void onClosed(int source) {
// Ad close callback
}
// Show error callback (applicable to: all ad units)
@Override
public void onShowError(TAdErrorCode errorCode) {
// Ad show failed callback
}
}
Reminder: source indicates the ad network. Refer to the Ad Source Correlation Table. For example, if the filled ad is from Pangle, then source = 6.
Show Ad
Display the splash ad.
// Show the splash ad
tSplashAd.showAd(tSplashView);
/**
* Optional
* For apps that need to track ad scene impressions, set the scene value here.
* The first parameter is a custom scene name; the second is the ad count.
*/
String sceneToken = tSplashAd.enterScene("splash_scene_name", 1);
tSplashAd.showAd(tSplashView, sceneToken);
/**
* Optional
* Allows the app to pass a logo and app name by adding a sub-layout
* (applicable to: Hisavana SSP SPLASH_VIEW mode, Mintegral).
* The SDK renders the sub-layout to display media logo info at the bottom.
* The bottom area occupies 20% of the screen height.
*/
View logoLayout = LayoutInflater.from(this).inflate(R.layout.splash_logo_layout, null, false);
tSplashAd.showAd(tSplashView, logoLayout);
Preview:

Destroy Ad
Release ad resources promptly to prevent memory leaks.
// Destroy the ad object when leaving the ad scene.
@Override
protected void onDestroy() {
super.onDestroy();
if (tSplashAd != null) {
tSplashAd.destroy();
tSplashAd = null;
}
}
Other APIs
| API | Description |
|---|---|
| tSplashAd.hasAd() | Whether a ready ad is available |
| tSplashAd.resume() | Call in the lifecycle method |
| tSplashAd.pause() | Call in the lifecycle method |
Reminder: After integrating Mintegral, when the system calls onResume or onPause, the app must actively call the two lifecycle methods above to reduce Mintegral error counts.
