Menu

Splash ads

Import Splash Ad SDK:

java Copy
import 'package:secmtp_sdk/at_index.dart';
java Copy
import 'package:thinkup_sdk/at_index.dart';
java Copy
  loadSplash() async {
    await ATSplashManager.loadSplash(
        placementID: 'your placementId',
        extraMap: {}
    );
  }

The default ad loading timeout duration is 5000 milliseconds. If you need to adjust the ad loading timeout duration (unit: milliseconds), you must pass the following parameter:

tolerateTimeout(): int, required, used to set the loading timeout duration

java Copy
  loadSplash() async {
    await ATSplashManager.loadSplash(
        placementID: 'your placementId',
        extraMap: {
          ATSplashManager.tolerateTimeout(): 5000
        });
  }

1.2 Check for Ad Cache and Get Ad Status

Use the following code to check if there is ad cache:

java Copy
  splashReady() async {
    await ATSplashManager
        .splashReady(
        placementID: 'your placementId'
    );
  }

1.3 Enter Scene

java Copy
entrySplashScenario() async {
    await ATSplashManager.entrySplashScenario(
        placementID:'your placementId',
        sceneID: 'your sceneID',
        );
  }

To show the splash ad, simply call the display API and pass the display placement ID

java Copy
  showSplash() async {
    await ATSplashManager
        .showSplash(
        placementID: 'your placementId'
    );
  }

When using the scene function, display the ad through this API with parameters: Placement ID + Scene ID (Scene ID can be created via the TopOn backend)

java Copy
  showSceneSplash() async {
    await ATSplashManager
        .showSceneSplash(
      sceneID: 'your sceneID',
      placementID: 'your placementId',
    );
  }

1.5 Implement Splash Ad Listener

Introduction to ATSplashResponse properties:

SplashStatus: Splash ad status

placementID: Placement ID

requestMessage: Request information (error information)

extraMap: Callback Information

isDeeplinkSuccess: Whether DeepLink is successful

isTimeout: Whether the ad loading has timed out when the ad is loaded successfully

Refer to the sample code below:

java Copy
  splashListen() {
    ATListenerManager.splashEventHandler.listen((value) {

      switch (value.splashStatus) {
      // Ad loading failed
        case SplashStatus.splashDidFailToLoad:
          print("flutter splash--splashDidFailToLoad ---- placementID: ${value.placementID} ---- errStr:${value.requestMessage}");
          break;
      // Ad loading succeeded 
        case SplashStatus.splashDidFinishLoading:
          print("flutter splash--splashDidFinishLoading ---- placementID: ${value.placementID} ---- isTimeout:${value.isTimeout}");
          break;
      // Ad loading timed out 
        case SplashStatus.splashDidTimeout:
          print("flutter splash--splashDidTimeout ---- placementID: ${value.placementID}");
          break;
      // Ad displayed successfully 
        case SplashStatus.splashDidShowSuccess:
          print("flutter splash--splashDidShowSuccess ---- placementID: ${value.placementID} ---- extra:${value.extraMap}");
          break;
      // Ad display failed 
        case SplashStatus.splashDidShowFailed:
          print("flutter splash--splashDidShowFailed ---- placementID: ${value.placementID} ---- errStr:${value.requestMessage}");
          break;
      // Ad clicked 
        case SplashStatus.splashDidClick:
          print("flutter splash--splashDidClick ---- placementID: ${value.placementID} ---- extra:${value.extraMap}");
          break;
      // DeepLink triggered
        case SplashStatus.splashDidDeepLink:
          print("flutter splash--splashDidDeepLink ---- placementID: ${value.placementID} ---- extra:${value.extraMap} ---- isDeeplinkSuccess:${value.isDeeplinkSuccess}");
          break;
      // Ad closed
        case SplashStatus.splashDidClose:
          print("flutter splash--splashDidClose ---- placementID: ${value.placementID} ---- extra:${value.extraMap}");
          break;

        case SplashStatus.splashUnknown:
          print("flutter splash--splashUnknown");
          break;
      }
    });
  }

1.5 Preset Strategy Settings (Recommended)

To improve the ad loading effect of the first cold start, create a traffic group with SDK preset strategy for the splash ad placement, then configure a waterfall for this traffic group. It is also recommended to add a fallback ad source. Finally, export the SDK preset strategy and preset it into the application. For detailed integration documents, see the SDK Preset Strategy Usage Instructions.

Configuration Effect: It can implement SDK preset splash ad strategy and achieve the fallback function of the splash fallback ad source simultaneously. That is: this fallback ad source will initiate requests in parallel with the overall waterfall under the ad placement. Moreover, users will not necessarily use the fallback ad for the first request, but follow the parallel requests of the normal waterfall and fallback ad source. This can maximize monetization value.

1.5.1 Set the Path of the Exported JSON File

Call before initializing the SDK

java Copy
setPresetPlacementConfigPath() async {
    await ATInitManger.setPresetPlacementConfigPath(
        pathStr: "localStrategy"
    );
 }
  1. Android Notes

(1) Create a new directory named localStrategy under the src/main/assets directory of the project (the directory naming rule can be customized) for the following steps

(2) Place the JSON file exported from the backend into the newly created directory: src/main/assets/localStrategy

(3) If you adjust the name of localStrategy, the pathStr parameter passed to setPresetPlacementConfigPath must be the adjusted string

  1. iOS Notes

(1) You must place the JSON file exported from the backend into the Bundle of the project ([NSBundle mainBundle], the placement path cannot be modified)

(2) The pathStr parameter does not take effect for iOS

Previous
Initialization instructions
Next
Rewarded video
Last modified: 2026-01-07Powered by