Rewarded Video Manual Integration React Native
In addition to loading ironSource 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 set rewarded video manual load listeners.
This listener will trigger callbacks to inform you of ad availability and completions so you’ll know when to display ads and reward your users.
The SDK will notify your listener on all of possible events listed below:
/**
* The Rewarded Video ad view has opened.
* [adInfo] includes information about the loaded ad
*
* Android: onAdOpened
* iOS: didOpenWithAdInfo
*/
onAdOpened?: (adInfo: IronSourceAdInfo) => void;
/**
* The Rewarded Video ad view is about to be closed.
* [adInfo] includes information about the loaded ad
*
* Android: onAdClosed
* iOS: didCloseWithAdInfo
*/
onAdClosed?: (adInfo: IronSourceAdInfo) => void;
/**
* The user completed watching the video, and should be rewarded.
* [placement] placement will include the reward data.
* [adInfo] includes information about the loaded ad
*
* Android: onAdRewarded
* iOS: didReceiveRewardForPlacement
*/
onAdRewarded?: (placement: IronSourceRVPlacement, adInfo: IronSourceAdInfo) => void;
/**
* The rewarded video ad failed to show.
* [error] includes information about the error
* [adInfo] includes information about the loaded ad
*
* Android: onAdShowFailed
* iOS: didFailToShowWithError
*/
onAdShowFailed?: (error: IronSourceError, adInfo: IronSourceAdInfo) => void;
/**
* 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.
* [placement] placement will include the reward data.
* [adInfo] includes information about the loaded ad
*
* Android: onAdClicked
* iOS: didClick
*/
onAdClicked?: (placement: IronSourceRVPlacement, adInfo: IronSourceAdInfo) => void;
/**
* Indicates that the Rewarded video ad was loaded successfully.
* [adInfo] includes information about the loaded ad.
*
* Android: onAdReady
* iOS: didLoadWithAdInfo
*/
onAdReady?: (adInfo: IronSourceAdInfo) => void;
/**
* Invoked when the rewarded video failed to load.
* [error] includes information about the error.
*
* Android: onAdLoadFailed
* iOS: didFailToLoadWithError
*/
onAdLoadFailed?: (error: IronSourceError) => void;
Set the LevelPlayRewardedVideoManual listener
IronSource.setLevelPlayRewardedVideoManualListener([YOUR_LISTENER])
Step 2: Manually load rewarded video ads
Request a rewarded video ad 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.