Before requesting the ad, register your ad units with Meson. This is a one-time step and is not required prior to each ad request.
string[] interstitialAdUnits = {"AD_UNIT_ID_1","AD_UNIT_ID_2"};
Meson.LoadInterstitialPluginsForAdUnits(interstitialAdUnits);
If you miss to Initialize the SDK, this method will fail to return a response. If your game is distributed on both iOS and Android, you only need to import the plugin once, but you must create different apps and ad units for each platform on Meson UI.
#if UNITY_IOS
interstitialAdUnit = "YOUR_IOS_AD_UNIT_ID";
#elif UNITY_ANDROID
interstitialAdUnit = "YOUR_ANDROID_AD_UNIT_ID";
#endif
Meson.RequestInterstitialAd(interstitialAdUnit)
Show the interstitial Ad on the screen.
Meson.ShowInterstitialAd(interstitialAdUnit);
Remove the interstitial ad from the screen using DestroyInterstitial
.
Meson.DestroyInterstitialAd(interstitialAdUnit);
Track the ad lifecycle for Interstitial ads. All the available events for interstitial ads are listed below.
MesonManager.InterstitialAdLoadedEvent += InterstitialAdLoaded
// create your handler
private void InterstitialAdLoaded (string adUnitId)
{
// code you wanna execute
}
// Fired when an interstitial ad is loaded and ready to be shown
public static event Action<string> InterstitialAdLoadedEvent;
// Fired when an interstitial ad fails to load
public static event Action<string, string> InterstitialAdLoadFailedEvent;
// Fired when an interstitial ad is dismissed
public static event Action<string> InterstitialAdDismissedEvent;
// Fired when an interstitial ad is clicked
public static event Action<string, Dictionary<string, object>> InterstitialAdClickedEvent;
// Fired when an interstitial ad failed to display
public static event Action<string> InterstitialAdDisplayFailedEvent;
// Fired when the user is taken away from the application
public static event Action<string> InterstitialAdUserLeftApplicationEvent;
// Fired when an interstitial ad is displayed
public static event Action<string> InterstitialAdDisplayedEvent;
//Fired when impression data is received.
public static event Action<string, MesonAdData> InterstitialAdImpressionTrackedEvent;