Rewarded Video Manual Integration 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: RewardedVideoManualListener.
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.
The SDK will notify your listener of all possible events listed below:
IronSource.setLevelPlayRewardedVideoManualListener(new LevelPlayRewardedVideoManualListener() {
// Indicates that the Rewarded video ad was loaded successfully.
// AdInfo parameter includes information about the loaded ad
@Override
public void onAdReady(AdInfo adInfo) {}
// Invoked when the rewarded video failed to load
@Override
public void onAdLoadFailed(IronSourceError error){}
// The Rewarded Video ad view has opened. Your activity will loose focus
@Override
public void onAdOpened(AdInfo adInfo){}
// The Rewarded Video ad view is about to be closed. Your activity will regain its focus
@Override
public void onAdClosed(AdInfo adInfo){}
// The user completed to watch the video, and should be rewarded.
// The placement parameter will include the reward data.
// When using server-to-server callbacks, you may ignore this event and wait for the ironSource server callback
@Override
public void onAdRewarded(Placement placement, AdInfo adInfo){}
// The rewarded video ad was failed to show
@Override
public void onAdShowFailed(IronSourceError error, AdInfo adInfo){}
// Invoked when the video ad was clicked.
// This callback is not supported by all networks, and we recommend using it
// only if it's supported by all networks you included in your build
@Override
public void onAdClicked(Placement placement, AdInfo adInfo){}
});
You can view the full listeners implementation here.
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.