Menu

Interstitials ads

Importing the Interstitial Ad SDK:

swift Copy
import 'package:anythink_sdk/at_index.dart';

Use the following code to load an Interstitial ad

swift Copy
loadInterstitialAd() async {
        ATinterstitialManager
        .loadInterstitialAd(placementID: 'you placementId', extraMap: {});
  }

Only for the Sigmob platform, use Sigmob's rewarded video ad source as an interstitial (Optional. Note: After enabling, the Sigmob interstitial Ad Source in the Taku dashboard must be configured with Sigmob's rewarded video parameters)

swift Copy
loadInterstitialAd() async {
         ATinterstitialManager
        .loadInterstitialAd(placementID: 'you placementId', extraMap: {
            ATinterstitialManager.UseRewardedVideoAsInterstitialKey(): true
        });
  }

1.2 Check if There Is a Cached Ad and Get Ad Status

Use the following code to check if there is a cached ad:

swift Copy
 _hasInterAdReady() async {
    await ATinterstitialManager
        .hasInterstitialAdReady(
      placementID: 'you placementId',
    )
        .then((value) {
      print('flutter Interstitial ad video cache $value');
    });
  }

Use the following code to get the ad status (return value type is Map). The key-value pairs are as follows:

  1. isLoading: Whether it is loading

  2. isReady: Whether there is a cached ad

  3. adInfo: The highest-priority cached ad info

swift Copy
 _checkInterAdStatus() async {
    await ATinterstitialManager
        .CheckInterstitialLoadStatus(
      placementID: 'b5bacad80a0fb1',
    )
        .then((value) {
      print('flutter Interstitial ad video status $value');
    });
  }

Get information about all available ads under the current ad placement

swift Copy
getInterstitialValidAds() async {
    await ATinterstitialManager
        .getInterstitialValidAds(
      placementID: Configuration.interstitialPlacementID,
    )
        .then((value) {
      print('flutter Interstitial ad video status $value');
    });
  }

1.3 Enter Scenario

swift Copy
entryInterstitialScenario(String placementID, String sceneID) async {
        ATInterstitialManager.entryInterstitialScenario(
        placementID: 'you placementId',
        sceneID: 'you sceneID',
        );
  }

To display an interstitial ad, simply call the show API and pass the ad placement ID.

swift Copy
_showInterAd() async {
         ATinterstitialManager
        .showInterstitialAd(
      placementID: 'you placementId',
    );
  }

When using the scenario feature, display the ad through this API. Parameters: Ad Placement ID + Scenario ID (the Scenario ID can be created in the Taku dashboard)

swift Copy
showSceneInterstitialAd() async {
        ATinterstitialManager
        .showSceneInterstitialAd(
      placementID: 'you placementId',
      sceneID: 'you sceneID',
    );
  }

1.5 Implement Interstitial Listeners

ATInterstitialResponse property description:

InterstitialStatus: Interstitial ad status

placementID: placementID

requestMessage: Request info (error message)

extraMap: Callback Info

isDeeplinkSuccess: isDeeplinkSuccess

An example notification for interstitial ad events is as follows:

swift Copy
_interListen() {

    ATListenerManager.interstitialEventHandler.listen((value) {

      switch (value.interstatus) {
        // Ad load failed
        case InterstitialStatus.interstitialAdFailToLoadAD:
          print("flutter interstitialAdFailToLoadAD ---- placementID: ${value.placementID} ---- errStr:${value.requestMessage}");
          break;
        // Ad loaded successfully  
        case InterstitialStatus.interstitialAdDidFinishLoading:
          print("flutter interstitialAdDidFinishLoading ---- placementID: ${value.placementID}");
          break;
        // Ad video playback started, some platforms have this callback  
        case InterstitialStatus.interstitialAdDidStartPlaying:
          print("flutter interstitialAdDidStartPlaying ---- placementID: ${value.placementID} ---- extra:${value.extraMap}");
          break;
        // Ad video playback ended, some ad platforms have this callback  
        case InterstitialStatus.interstitialAdDidEndPlaying:
          print("flutter interstitialAdDidEndPlaying ---- placementID: ${value.placementID} ---- extra:${value.extraMap}");
          break;
        // Ad video playback failed, some ad platforms have this callback  
        case InterstitialStatus.interstitialDidFailToPlayVideo:
          print("flutter interstitialDidFailToPlayVideo ---- placementID: ${value.placementID} ---- errStr:${value.requestMessage}");
          break;
        // Ad displayed successfully  
        case InterstitialStatus.interstitialDidShowSucceed:
          print("flutter interstitialDidShowSucceed ---- placementID: ${value.placementID} ---- extra:${value.extraMap}");
          break;
        // Ad display failed  
        case InterstitialStatus.interstitialFailedToShow:
          print("flutter interstitialFailedToShow ---- placementID: ${value.placementID} ---- errStr:${value.requestMessage}");
          break;
        // Ad clicked  
        case InterstitialStatus.interstitialAdDidClick:
          print("flutter interstitialAdDidClick ---- placementID: ${value.placementID} ---- extra:${value.extraMap}");
          break;
        // Deeplink  
        case InterstitialStatus.interstitialAdDidDeepLink:
          print("flutter interstitialAdDidDeepLink ---- placementID: ${value.placementID} ---- extra:${value.extraMap}");
          break;
        // Ad closed  
        case InterstitialStatus.interstitialAdDidClose:
          print("flutter interstitialAdDidClose ---- placementID: ${value.placementID} ---- extra:${value.extraMap}");
          break;

        case InterstitialStatus.interstitialUnknown:
          print("flutter interstitialUnknown");
          break;
      }
    });
}
Previous
Rewarded video
Next
Banner ads
Last modified: 2026-07-01Powered by