Rewarded Ads

Rewarded Ads are loaded automatically. You can observe ad loading events by specifying the delegate:

Rewarded rewarded = new Rewarded(this);
rewarded.setLoadDelegate(this);

The delegate should implement the following methods:

@Override
public void didLoad(AdInfo adInfo) {
    print("Rewarded - didLoadAd. AdInfo: " + adInfo) 
}

@Override
public void didFailToLoad(AdInfo adInfo, Error error) {
    print("Rewarded - didFailToLoadAd. AdInfo:" + adInfo + " Error: " + error.getLocalizedMessage()) 
}

Showing a Rewarded Ad

To show a rewarded ad, call showWithDelegate method of the Rewarded class:

rewarded.showWithDelegate(Activity, showDelegate);

The delegate should implement the following methods:

@Override
public void didDisplayAd(AdInfo adInfo) {
    System.out.println ("Rewarded - didDisplayAd. AdInfo:" + adInfo) 
}

@Override
public void didClickAd(AdInfo adInfo) {
    System.out.println("Rewarded - didDisplayAd. AdInfo:" + adInfo );
}

@Override
public void didHideAd(AdInfo adInfo) {
    System.out.println("Rewarded - didHideAd. AdInfo:" + adInfo );
}

@Override
public void didFailToDisplayAd(AdInfo adInfo, Error error) {
    System.out.println("Rewarded - didFail toDisplayAd. AdInfo:" + adInfo + error.getLocalizedMessage());
}

@Override
public void allNetworksDidFailToDisplayAd() {
    System.out.println("Rewarded - allNetworksDidFailToDisplayAd.");
}

@Override
public void didRewardUser() {
    System.out.println("Rewarded - didRewardUser");
}

Stopping and Starting Auto-Load

By default, Rewarded preload ads before any manual load attempt. So a Rewarded can use already preloaded ads instead of waiting on a manual load call to load new ads. To disable this feature you need to call the following method:

rewarded.setAutoload(false);

Once you disable autoload, you should load ads manually every time you need them to show:

rewarded.load();

Last updated