Warning: is_writable(): open_basedir restriction in effect. File(/var/www/clients/client2/web93/web/wp-content/uploads/broken-link-checker/blc-log.txt) is not within the allowed path(s): (/var/www/clients/client1/web15/web:/var/www/clients/client1/web15/private:/var/www/clients/client1/web15/tmp:/var/www/supersonic-knowledge.rtl.co.il/web:/srv/www/supersonic-knowledge.rtl.co.il/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web15/web/wp-content/plugins/broken-link-checker/core/init.php on line 141
Rewarded Video Integration for Android - Supersonic Knowledge Center

Rewarded Video Integration for Android

Get up and running with the Rewarded Video Ad Unit in 5 easy steps:

  1. Initialize the Rewarded Video Unit
  2. Add Rewarded Video Listener’s Functions
  3. Show a Video Ad to Your Users
  4. Reward the User
  5. Verify Your Integration


Before You Start

Make sure you have correctly integrated the Supersonic SDK as well as any additional Ad Network Adapters into your application. Integration is outlined here.

Step 1. Initialize the Rewarded Video Unit

Initialize the Rewarded Video Ad Unit. Once initialized, Supersonic will automatically check all available Ad Networks for videos throughout the life-cycle of the app. You should initialize Rewarded Video as early as possible to allow time for all Ad Networks to prepare Video content. We recommend doing so on app launch.

public class YourActivity extends Activity implements RewardedVideoListener
  //Declare the Supersonic Mediation Agent
  private Supersonic mMediationAgent;
  public void onCreate(Bundle savedInstanceState) 
    //Get the mediation publisher instance 
    mMediationAgent = SupersonicFactory.getInstance();
    //Set the Rewarded Video Listener
    //Set the unique id of your end user.
    String mUserId = "APPLICATION_USER_ID_HERE"; 
    //Set the Application Key - can be retrieved from Supersonic platform
    String mAppKey = "APPLICATION_APP_KEY_HERE";
    //Init Rewarded Video
    mMediationAgent.initRewardedVideo(this, mAppKey, mUserId);

  1. “this” is the activity in which the Ad Unit should be presented.
  2. mAppKey is the unique ID of your Application in your Supersonic account.
  3. mUserId is the unique ID of your end user. We support NSString from 1 to 64 characters. Common practice is to use the Apple Advertising ID (IDFA). More information on User IDs can be found here.

Step 2. Add Rewarded Video Listener’s Functions

The Supersonic SDK fires several events to inform you of ad availability. By implementing the RewardedVideoListener you will receive the RewardedVideo events including onVideoAvailabilityChanged callback. Create an OnRewardedVideoListener class to implement the RewardedVideoListener interface.  You will pass this object within the setRewardedVideoListener(…) method. [] Last two sentences?

The SDK will notify your Listener of all possible events listed below:

RewardedVideoListener mRewardedVideoListener = new RewardedVideoListener()
  //Invoked when initialization of RewardedVideo has finished successfully.
  public void onRewardedVideoInitSuccess() {
  //Invoked when RewardedVideo initialization process has failed. 
  //SupersonicError contains the reason for the failure. 
  public void onRewardedVideoInitFail(SupersonicError se) {
   //Retrieve details from a SupersonicError object.
    int errorCode =  se.getErrorCode();
    String errorMessage = se.getErrorMessage();
    if (errorCode == SupersonicError.ERROR_CODE_GENERIC){
       //Write a Handler for specific error's.
  //Invoked when RewardedVideo call to show a rewarded video has failed
  //SupersonicError contains the reason for the failure. 
	public void onRewardedVideoShowFail(SupersonicError se) {
  //Invoked when the RewardedVideo ad view has opened.
  //Your Activity will lose focus. Please avoid performing heavy 
  //tasks till the video ad will be closed.
  public void onRewardedVideoAdOpened() {
  //Invoked when the RewardedVideo ad view is about to be closed.
  //Your activity will now regain its focus.
  public void onRewardedVideoAdClosed() {
  //Invoked when there is a change in the ad availability status.
  //@param - available - value will change to true when rewarded videos are available. 
  //You can then show the video by calling showRewardedVideo().
  //Value will change to false when no videos are available.
  public void onVideoAvailabilityChanged(boolean available) {
    //Change the in-app 'Traffic Driver' state according to availability.
    public boolean rewardedVideoAvailability = available;
  //Invoked when the video ad starts playing.
  public void onVideoStart() {
  //Invoked when the video ad finishes playing.
  public void onVideoEnd() {
  //Invoked when the user completed the video and should be rewarded. 
  //If using server-to-server callbacks you may ignore this events and wait for 
  //the callback from the Supersonic server.
  //@param - placement - the Placement the user completed a video from.
  public void onRewardedVideoAdRewarded(Placement placement) {
  //TODO - here you can reward the user according to the given amount.
  String rewardName = placement.getRewardName();
  int rewardAmount = placement.getRewardAmount();


  • Please do not assume the callbacks are always running on the main thread. Any UI interaction or updates resulting from Supersonic callbacks need to be passed to the main thread before executing.
  • Supersonic provides an error code mechanism to help you understand errors you may run into during integration or live production. See the complete guide here.

Step 3. Show a Video Ad to Your Users

By correctly implementing the RewardedVideoListener and its functions, you can receive the availability status through the onVideoAvailabilityChanged callback. []

Alternatively, ask for ad availability directly by calling:

boolean available = mMediationAgent.isRewardedVideoAvailable();

Once an Ad Network has an available video you are ready to show this video ad to your users.This is the ideal moment to insert a trigger to encourage your users to watch the video ad.

With Supersonic’s Ad Placements, you can customize and optimize the Rewarded Video experience. This tool enables you to present videos to your users from different placements depending on the reward. You can use the below function to define the exact Placement you’d like to show an ad from. Navigate to the Ad Placement document for more details.

By calling the showRewardedVideo() method on your MediationAgent instance, you can show a Video Ad to your users. In the below function you can also define the exact Placement you want to show an ad from. The Reward settings of this Placement will be pulled from the Supersonic server:[]


To get details about the specific Reward associated with each Ad Placement, you can call the following:

Placement placement = mMediationAgent.getPlacementInfo(placementName);
//Placement can return null if the placementName is not valid.
if(placement != null)
    String rewardName = placement.getRewardName();
    int rewardAmount = placement.getRewardAmount();

Step 4. Rewarding the User

The Supersonic SDK will fire the onRewardedVideoAdRewarded event each time the user successfully completes a video. Have the RewardedVideoListener in place to receive this event, so that you can reward the user successfully.

The Placement object contains both the Reward Name & Reward Amount of the Placement as defined in your Supersonic Admin:

public void onRewardedVideoAdRewarded(Placement placement)
    //TODO - here you can reward the user according to the given amount
    String rewardName = placement.getRewardName();
    int rewardAmount = placement.getRewardAmount();


  1. The default setting in your Supersonic account is to notify you of user completions/rewards via the supersonicAdRewarded:amount callback within the client of your app. Additionally, if you would also like to receive notifications to your back-end server, you can turn on server-to-server callbacks.
  2. If you turn on server-to-server callbacks, remember not to reward the user more than once for the same completion. We will be firing both the client-side callback and the server-to-server callback, so you will get two notifications for each completion. To utilize server-to-server callbacks, see here.

Step 5. Verify Your Integration

The Supersonic SDK provides an easy way to verify that your Rewarded Video Mediation integration was completed successfully. To verify your Supersonic SDK integration as well as any additional Ad Networks you may have implemented, navigate to this article.

You are now all set to deliver Rewarded Video in your application.

Tip: If this is a new integration, your application in your Supersonic account will by default be in ‘Test Mode‘. While in Test Mode, the Supersonic SDK will print more logs to the console in order to provide greater visibility into the SDK processes. In addition, the first ad you will see will be a Supersonic test campaign. Turn on Live Ad Inventory in the App Settings page of your Supersonic console. [] Should we have a customized screenshot for Android? Note the apple in the upper left corner
Supersonic Switch App to Live Mode Rewarded Video Ad Unit

What’s Next?
Follow our integration guides to integrate additional Rewarded Video Ad networks on our Video Mediation platform or configure additional Ad Units: