-
Notifications
You must be signed in to change notification settings - Fork 4
Rewarded Ads
⚡ Before you start
Make sure you have correctly Initialize CAS.
This guide explains how to integrate rewarded video ads into an Android app.
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 useLoadingManagerMode.Manual
only.
Manual load Rewarded ads.
manager.loadRewarded();
You can get a callback for the successful loading of the ads:
manager.setAdLoadCallback(LoadCallback());
class LoadCallback extends AdLoadCallback {
@override
void onAdFailedToLoad(AdType adType, String? error) {
if (adType == AdType.Rewarded) {
// Rewarded failed to load with error
}
}
@override
void onAdLoaded(AdType adType) {
if (adType == AdType.Rewarded) {
// Rewarded loaded
}
}
}
You can ask for the ad availability directly by calling the following function:
bool adLoaded = manager.isRewardedAdReady();
The AdCallback
handles events related to displaying your Rewarded ad.
class RewardedListener extends AdCallback {
@override
void onClicked() {
// Called when ad is clicked
}
@override
void onClosed() {
// Called when ad is dismissed
}
@override
void onComplete() {
// Called when ad is completed
}
@override
void onImpression(AdImpression? adImpression) {
// Called when ad is paid.
}
@override
void onShowFailed(String? message) {
// Called when ad fails to show.
}
@override
void onShown() {
// Called when ad is shown.
}
}
When an error occurs during ad impression, executed theonShowFailed()
only.
onClosed()
in this case will not be executed, since the impression is not considered successful.
Read more about eventonShown
with Impression level data.
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 AdCallback
instances as arguments.
-
callback
The callback for Rewarded ad events.
When you show a rewarded ad, you will use anAdCallback
object to handle reward eventsonComplete()
.
manager.showRewarded(callback);
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 AdCallback.onComplete()
event will be invoked in any case.
Disabled by default.
CAS.allowInterstitialAdsWhenVideoCostAreLower(true);
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.setMutedAdSounds(true);
🔗 Done! What’s Next?
- Try another ad format:
- Read more about Impression level data.
Android SDK | iOS SDK | Unity SDK | Flutter SDK | App-ads.txt | cleveradssolutions.com | [email protected]
- Project Setup
- Include Android
- Include iOS
- Additional Network Steps
- App-ads.txt