Splash
Splash Screen ads are a special ad format that appear when an app is soft-launched or cold-launched.
Introduction
For the ad styles that appear at natural endpoints and transition segments, please refer to the ad size 9:20 supported by the ad source Hisavana, as shown in the figure:
9:20 |
---|
![]() |
Build Components
Please add TSplashView in xml.
Reminder: For Hisavana SPLASH_VIEW mode and Mintegral opening screen, you must add View in xml. For other cases, you only need to add View during show.
<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 Ads
Please set the corresponding parameters and listening callbacks.
Strong Recommendation:
- During ad display, avoid using the same ad object to repeatedly initiate ad requests. If you need to initiate a new ad request, create a new ad object. Otherwise, the ad request will be invalid and an error message will be returned through the onError callback;
- Because some ad sources occasionally fail to execute the onAdShowError callback, apps that rely on this callback to handle jump logic may get stuck on the splash page. To avoid such problems, add a timeout mechanism to the splash page of your app. For example, if the splash ad is not successfully displayed within about 3 seconds, jump to the next page on your own.
// Bind the open screen advertising object
TSplashView tSplashView = findViewById(R.id.splash_ad);
// "splash_id" is the opening screen ad slot ID
TSplashAd tSplashAd = new TSplashAd(this, "splash_id");
// Build and set up the ad request body
tSplashAd.setRequestBody(
new TAdRequestBody.AdRequestBodyBuild()
.setAdListener(new TAdAlliance())
.build());
// Listen for skip actions
tSplashAd.setOnSkipListener(new TOnSkipListener());
// After loading the advertisement, the optimal advertisement callback will be returned within the set waiting time.
tSplashAd.loadAd();
// Example: 'Timeout Mechanism'
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
// Execute jump logic
}
}, 3000);
// splash screen skip action listener
private class TOnSkipListener implements OnSkipListener {
@Override
public void onClick() {
SplashAdActivity.this.finish();
Log.i("listener", "skip button click");
}
@Override
public void onTimeReach() {
Log.i("listener", "time reach");
}
}
// Ad listener, listens for callbacks of ad loading completion (filling), display, click, exception, and closing actions
private static class TAdAlliance extends TAdListener {
// Loading completion callback (applicable ad slots: all ad slots)
@Override
public void onLoad() {
// Ad loaded callback
}
// Abnormal callback (applicable ad slots: all ad slots)
@Override
public void onError(TAdErrorCode errorCode) {
// Ad failed callback
}
// Display callback (applicable ad slots: Splash, Interstitial, Banner, Reward)
@Override
public void onShow(int source) {
// Ad show callback
}
// Click callback (applicable ad slots: Splash, Interstitial, Banner, Reward)
@Override
public void onClicked(int source) {
// Ad click callback
}
// Close callback (applicable ad slots: Splash, Interstitial, Banner, Reward)
@Override
public void onClosed(int source) {
// Ad close callback
}
// Display failure callback (applicable ad slots: all ad slots)
@Override
public void onShowError(TAdErrorCode errorCode) {
// Ad show failed callback
}
}
Reminder: source represents the advertising source, please refer to Advertising Source Association Table; For example: this time the advertisement is filled with pangle ads, then source=6.
Display Ads
Please display the opening screen advertisement.
// Show Splash screen ads
tSplashAd.showAd(tSplashView);
/**
* Optional
* For applications that need to count the arrival of advertising scenes, you can set the scene value yourself
* The main purpose is to count the utilization rate of the current advertising scene. The first parameter is the customized scene name, and the second parameter is the number of advertisements.
*/
String sceneToken = tSplashAd.enterScene("splash_scene_name", 1);
tSplashAd.showAd(tSplashView, sceneToken);
/**
* Optional
* Allow the application to pass in the logo and name by adding a sublayout
* The sdk internally loads a sublayout to render the bottom media logo information. The bottom area is 20% of the height of the mobile phone screen.
*/
View logoLayout = LayoutInflater.from(this).inflate(R.layout.splash_logo_layout, null, false);
tSplashAd.showAd(tSplashView, logoLayout);
The effect is as shown in the figure:

Destroy Ads
Please recycle ads in time, otherwise the App will cause memory leaks.
// After exiting the advertising scene, please destroy the advertising object.
@Override
protected void onDestroy() {
super.onDestroy();
if(tSplashAd != null){
tSplashAd.destroy();
tSplashAd = null;
}
}
Other APIs
API call | Introduce |
---|---|
tSplashAd.hasAd() | Whether there are currently available ads |
tSplashAd.resume() | Please call it in the life cycle |
tSplashAd.pause() | Please call it in the life cycle |
Reminder: After adding the Mintergral advertising source, when the system's onResume and onPause are called, the media needs to actively call the above two life cycle callback methods, which can reduce the number of Mintergral advertising source errors.