Rewarded

Last Updated on: 19 Sep, 2023

Load plugins

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[] rewardedAdUnits = {"AD_UNIT_ID_1","AD_UNIT_ID_2"};
Meson.LoadInterstitialPluginsForAdUnits(rewardedAdUnits);

Request a Rewarded ad

INFO

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 Rewarded Ad

Show the interstitial Ad on the screen.

Meson.ShowInterstitialAd(interstitialAdUnit);

Destroy Rewarded Ad

Remove the interstitial ad from the screen using DestroyInterstitial.

Meson.DestroyInterstitialAd(interstitialAdUnit);

Register Callbacks

Track the ad lifecycle for Rewarded ads. All the available events for Rewarded 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;

 // Fired when a rewarded video completes. Includes all the data available about the reward.

public static event Action<string, Dictionary<string, object>> RewardedVideoAdReceivedRewardsEvent;