Rewarded Ads - cleveradssolutions/CAS-ReactNative GitHub Wiki

:zap: Before you start
Make sure you have correctly Initialize CAS.


This guide explains how to integrate rewarded video ads into an Android app.

Load an ad

By default, the auto-load ads mode is used and a load method does not need to be called. Call manual load ad before each show if you use LoadingManagerMode.Manual only.

Manual load Rewarded ads.

manager.loadRewardedAd();

You can get a callback for the successful loading of the ads:

manager.addListener(MediationManagerEvent.AdLoaded, (e) => {
    // e contains ad type
});

manager.addListener(MediationManagerEvent.AdFailedToLoad, (e) => {
    // e contains ad type and error
});

Check the ad availability

You can ask for the ad availability directly by calling the following function:

const adLoaded = await manager.isRewardedAdReady();

Ad Callback

The ShowAdCallbacks handles events related to displaying your Rewarded ad.

type ShowAdCallbacks = {
  onImpression?: (ad: AdImpression) => void;
  onShown?: () => void;
  onShowFailed?: (message: string) => void;
  onClicked?: () => void;
  onComplete?: () => void;
  onClosed?: () => void;
}

When an error occurs during ad impression, executed the onShowFailed() only.
onClosed() in this case will not be executed, since the impression is not considered successful.

Read more about event onShown with Impression level data.

Show the ad

Before displaying a rewarded ad to users, you must present the user with an explicit choice to view rewarded ad content in exchange for a reward. Rewarded ads must always be an opt-in experience.

The showRewardedAd() method requires ShowAdCallbacks instance as arguments.

  • callbacks The callbacks for Rewarded ad events.
    When you show a rewarded ad, you will use an ShowAdCallbacks object to handle reward events onComplete().
manager.showRewardedAd(callbacks);

Allow Interstitial ads

Sometimes a situation occurs when filling Rewarded ads is not enough, in this case, you can allow the display of Interstitial ads to receiving a reward in any case. This option will compare ad cost and serve regular interstitial ads when rewarded video ads are expected to generate less revenue.
Interstitial Ads does not require to watch the video to the end, but the onComplete() event will be invoked in any case.
Disabled by default.

CAS.setSettings({
    allowInterstitialAdsWhenVideoCostAreLower: true,  
});

Muted Ad sounds

Indicates if the application’s audio is muted. Affects initial mute state for all ads.
Use this method only if your application has its own volume controls.

CAS.setSettings({
    mutedAdSounds: true,
});

🔗 Done! What’s Next?