Skip to main content

Interstitial

Step 1.Prerequisites#

This document mainly introduces how to integrate Interstitial Ads :

  • Use Android Studio 3.2 or later
  • minSdkVersion 16 or later
  • compileSdkVersion 28 or later
  • Recommended: Create your TradPlus Apps and get your AppId
  • Initialize the TradPlus SDK for Unity3DAndroid

Step 2.Integration#

2.1 Create an ad#

//Create adUnitId from your App
TradPlus.LoadInterstitialPluginsForAdUnits("AdUnitId");

2.2 Load an Ad#

/**
* @param AdUnitId create adUnit Id from your App
* @param Autostitial Ads show an ad automatically between activities,pass true to set auto load Mode.
*/
TradPlus.RequestInterstitialAd("AdUnitId",true);

2.3 Implement Event Listeners#

// This listener must be called , for each ad network will callback you add(multi-cache)
// Called when an ad is loaded after 'LoadAd'.
TradPlusManager.OnInterstitialLoadedEvent += OnInterstitialLoadedEvent;
// Called when an ad is failed after 'LoadAd'.
TradPlusManager.OnInterstitialFailedEvent += OnInterstitialFailedEvent;
// Called when a Interstitial ad starts playing.
TradPlusManager.OnInterstitialShownEvent += OnInterstitialShownEvent;
// Called when a Interstitial ad is clicked.
TradPlusManager.OnInterstitialClickedEvent -= OnInterstitialClickedEvent;
// Called when a Interstitial ad is closed.
// Reload the ad; automatically reload is set to true, no need to load the ad
TradPlusManager.OnInterstitialDismissedEvent += OnInterstitialDismissedEvent;
//This listener will returns a status to the results of the entire Ad load(Option)
/*
* isLoadedSucces == false,no ad network has been loaded successfully,
* isLoadedSucces == true,have available ads
*
*/
TradPlusManager.OnInterstitialAllLoadedEvent += OnInterstitialAllLoadedEvent;

2.4 Set the SceneId#

TradPlus.InterstitialEntryAdScenario("AdUnitId");
TradPlus.InterstitialEntryAdScenario("AdUnitId","sceneId");

Learn more about SceneId

You can create SceneId , as shown below :

You can get SceneId , as shown below :

2.5 Show an Ad#

//AutoLoad is set to true, ads will be displayed directly if there are ads, ads will be automatically loaded if there are no ads
//If you choose to call SceneId when entering the interface where the ad slot is located,
//you must pass in the SceneId while showing the ad
TradPlus.ShowInterstitialAd("AdUnitId","sceneId");
//otherwise you only need to pass in the AdUnitId as a parameter
TradPlus.ShowInterstitialAd("AdUnitId");

2.6 Check is Ready#

//if you use AutoLoad Mode,when IsInterstialReady() == false will reload the ad
TradPlus.IsInterstialReady("AdUnitId");

Step 3.Note#

(1)AdUnitId#

(2)When you reload an ad#

- if you don't use AutoLoad Mode:
- Reload the ad after `OnInterstitialAllLoadedEvent` isLoadedSucces == false
- Reload the ad after `OnInterstitialDismissedEvent` and `IsInterstialReady()` == false