Rewarded Video Ads - san-sdk/sample GitHub Wiki

Rewarded video ads are a great way to keep users engaged in your app while earning ad revenue. The reward generally comes in the form of in-game currency (gold, coins, power-ups, etc.) and is distributed to the user after a successful video completion.

Prerequisites

  1. Already has a PlacementId using the format Rewarded Video.
  2. Follow our steps to Integrate the SAN SDK into your project.
  3. Integrated the SAN Ad SDK

Basic Integration

Step 1: Request and Cache the Rewarded Video

SANReward rewardedAd = new SANReward(context, placementId);
rewardedAd.setAdLoadListener(new IAdListener.AdLoadListener() {
    @Override
    public void onAdLoaded(SANAd adWrapper) {
        // Called when the video for the given placementId has loaded.
    }

    @Override
    public void onAdLoadError(AdError adError) {
        // Called when a video fails to load for the given placementId. 
    }
});
rewardedAd.setAdActionListener(new IAdListener.AdActionListener() {
    @Override
    public void onAdImpressionError(AdError error) {
        // Called when a rewarded video show failed.
    }

    @Override
    public void onAdImpression() {
        // Called when a rewarded video starts playing.
    }

    @Override
    public void onAdClicked() {
        //  Called when a rewarded video is clicked.
    }

    @Override
    public void onAdCompleted() {
        // Called when a rewarded video is completed and the user should be rewarded.
    }

    @Override
    public void onAdClosed(boolean hasRewarded) {
        // Called when a rewarded video is closed.
        // If hasRewarded is true, the user has won the award
    }
});
rewardedAd.load();//Request ad

Step 2:Display an Rewarded Ad

If isAdReady() returns true, display the Rewarded Ad by calling the show() method

if (rewardedAd.isAdReady()) {
    rewardedAd.show();
}

Step 3:Destory

When the Rewarded Ad dismissed use the destroy()

rewardedAd.destroy();