Rewarded Video Manual Integration for Xamarin Android

In addition to loading ironSource SDK rewarded video ads automatically, you can also set rewarded video ads to load manually. To do this, you must set the entire session loading mode prior to SDK initialization. This is supported from ironSource SDK 7.2.0+ (Beta 7.1.13 Android).

Step 1: Set up rewarded video manual loading

Set the operation mode of rewarded video ads before you initialize the ironSource SDK. By setting the manual mode, you will also create a new listener.

This listener will trigger callbacks to inform you of ad availability and completions so you’ll know when to display ads and to reward your users. To receive these events, we suggest the following:

    1. Create a class which inherits from LevelPlayManualRewardedVideoDelegate. It is recommend to create a separate class for each delegate

              public class LevelPlayManualRewardedVideoListener : Activity, ILevelPlayRewardedVideoManualListener
              {
                  private Activity activity;
                  public LevelPlayManualRewardedVideoListener(Activity activity)
                  {
                      this.activity = activity;
                  }
                  public void OnAdClicked(Placement placement, AdInfo adInfo)
                  {
                  }
                  public void OnAdClosed(AdInfo adInfo)
                  {
                  }
                  public void OnAdLoadFailed(IronSourceError ironSourceError)
                  {
                  }
                  public void OnAdOpened(AdInfo adInfo)
                  {
                  }
                  public void OnAdReady(AdInfo adInfo)
                  {
                  }
                  public void OnAdRewarded(Placement placement, AdInfo adInfo)
                  {
                  }
                  public void OnAdShowFailed(IronSourceError ironSourceError, AdInfo adInfo)
                  {
                  }
              }
      

    2. Create and instantiate a LevelPlayManualRewardedVideoListener object. Set the delegate using the new object and start listening to IILevelPlayRewardedVideoManualListener.
      Make sure to call the  SetLevelPlayRewardedVideoManualListener before the init response.
       LevelPlayManualRewardedVideoListener mLevelPlayManualRewardedVideoListener;
      // Define the listener 
      mLevelPlayManualRewardedVideoListener = new LevelPlayManualRewardedVideoListener(this);
      // Set the delegate
      IronSource.SetLevelPlayRewardedVideoManualListener(mLevelPlayManualRewardedVideoListener);
      

    Step 2: Manually load rewarded video ads

    Request a rewarded video ad d before you plan on showing it to your users as the loading process can take time. Use the following API to load your ad: 

    IronSource.LoadRewardedVideo();

    If you’d like to serve multiple rewarded video ads in your app, you should repeat this step after you’ve shown and closed the previous rewarded video ad. Once the onRewardedAdClosed callback is triggered, you’ll be able to load a new rewarded video ad.

    Done!

    After defining your operation loading mode to Manual, you can complete your Rewarded Video integration, as described here.