Skip to main content

Splash

Splash ads are a special ad format that displays when an app is launched (warm or cold start).

Introduction

Ad format that appears at natural endpoints and transitions, refer to the ad size supported by Hisavana ad source: 9:20, effect as shown:

9:20

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.

Building Components

Please add TSplashView in XML.

Reminder: Hisavana SPLASH_VIEW mode, Mintegral splash must add View in XML, other cases only need to add View when showing.

<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 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:

  1. 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;
  2. Due to some ad sources occasionally not executing the onAdShowError callback, applications relying on this callback for redirection logic may get stuck on the splash page. To avoid such issues, please add a timeout mechanism to your app's splash page. For example, if the splash ad fails to display successfully within approximately 3 seconds, please proceed to the next page automatically.
// Bind splash ad object
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 ad request body
tSplashAd.setRequestBody(
new TAdRequestBody.AdRequestBodyBuild()
.setAdListener(new TAdAlliance())
.build());
// Listen for skip action
tSplashAd.setOnSkipListener(new TOnSkipListener());
// After loading ads, return the optimal ad callback within the set waiting time
tSplashAd.loadAd();

// Example: 'Timeout mechanism'
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
// Execute redirection logic
}
}, 3000);

// Splash skip action listener
private class TOnSkipListener implements OnSkipListener {
@Override
public void onClick() {
// Please close current page
this.finish();
Log.i("listener", "skip button click");
}
@Override
public void onTimeReach() {
Log.i("listener", "time reach");
}
}

// 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 splash ad.

// Display splash ad
tSplashAd.showAd(tSplashView);
/**
* 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 = tSplashAd.enterScene("splash_scene_name", 1);
tSplashAd.showAd(tSplashView, sceneToken);
/**
* Optional
* Allow applications to pass logo and name by adding child layout (applicable scenarios: Hisavana SPLASH_VIEW mode, Mintegral)
* SDK internally loads child layout to render bottom media logo information, bottom area is 20% of phone screen height
*/
View logoLayout = LayoutInflater.from(this).inflate(R.layout.splash_logo_layout, null, false);
tSplashAd.showAd(tSplashView, logoLayout);

Effect as shown:

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

Other APIs

API CallDescription
tSplashAd.hasAd()Whether there is currently an available ad
tSplashAd.resume()Call in lifecycle
tSplashAd.pause()Call in lifecycle

Reminder: After adding Mintergral ad source, when the system's onResume, onPause are called, the media needs to actively call the above two lifecycle callback methods, which can reduce the number of errors generated by the Mintergral ad source.