The MVP Android Developer Hub

Welcome to the MVP Android developer hub. You'll find comprehensive guides and documentation to help you start working with MVP Android as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Rewarded Ads

Introduction

Rewarded ads are an engaging ad format that shows a short video ad to the user and in exchange the user will earn a reward. The user must consent and watch the video completely through to the end in order to earn the reward.

Important

The speed and stability of users internet connections may vary. It is highly recommended to fetch as far in advance of showing an ad as possible. This helps to ensure that all necessary assets are downloaded. For example, you may want to fetch an ad when a level starts, or after a previous ad has been shown.

Importing the Class

Before you can make a request to display a Rewarded ad, you must import the Rewarded class.

import com.fyber.fairbid.ads.Rewarded;

Make an Ad Request

After importing the Rewarded class, you must must make a request to display the Rewarded ads.

import com.fyber.fairbid.ads.Rewarded;
 
String placementId = "12345";
Rewarded.request(placementId);

Adding Callbacks

The callback code below is required for SDK to properly track the activity of your ad

Rewarded.setRewardedListener(new RewardedListener() {
    @Override
    public void onShow(String placementId) {
        // Called when the rewarded ad from placement 'placementId' shows up. In case the ad is a video, audio play will start here.
    }
 
    @Override
    public void onClick(String placementId) {
        // Called when the rewarded ad from placement 'placementId' is clicked
    }
 
    @Override
    public void onHide(String placementId) {
        // Called when the rewarded ad from placement 'placementId' hides. In case the ad is a video, audio play will stop here.
    }
 
    @Override
    public void onShowFailure(String placementId) {
        // Called when an error arises when showing the rewarded ad from placement 'placementId'
    }
 
    @Override
    public void onAvailable(String placementId) {
        // Called when a rewarded ad from placement 'placementId' becomes available
    }
 
    @Override
    public void onUnavailable(String placementId) {
        // Called when a rewarded ad from placement 'placementId' becomes unavailable
    }
 
    @Override
    public void onCompletion(@NonNull String placementId, boolean userRewarded) {
        // Called when a rewarded ad from placement 'placementId' finishes playing 
    }
});

Example showing an ad

The following example checks to see if a is available and if it is, uses the show request to display the ad.

String placementId = "12345";
if (Rewarded.isAvailable(placementId)) {
    Rewarded.show(placementId, context);
}

Stop Requesting An Ad

In case a placement is no longer relevant for your user, you can stop requesting it.

String placementId = "12345";
Rewarded.stopRequesting(placementId);

Important

Use stopRequesting to disable the FairBid SDK Auto-Request functionality for a specific placement. If you continue requesting ads for placements that will not be shown, the performance of your placement can be impacted.

Server Side Rewarding

For details on configuring Server Side Rewarding, click here.


Rewarded Ads


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.