Documentation

Unity Ads Monetization


Android API reference

Unity Ads Monetization


Implement rewarded ads in Android

Implement rewarded ads in your Android app. Load ad content, display it through Java code, and use a listener to manage ad events and reward logic.
Read time 1 minuteLast updated a day ago

Rewarding users for watching ads increases user engagement, resulting in higher revenue. For example, games might reward users with in-game currency, consumables, additional lives, or experience-multipliers. For more information on how to effectively design your rewarded ads, refer to the monetization strategy guide.

Rewarded video ad load example

Call
show()
on the retained
RewardedAd
instance, passing the activity, a
ShowConfiguration
, and a
RewardedShowListener
. The listener provides
onStarted
,
onClicked
, and
onFailed
callbacks for standard ad lifecycle events, as well as two reward-specific callbacks:
onRewarded
, which fires when the user earns a reward, and
onCompleted
, which fires after it when the ad closes. Because both callbacks can fire in sequence, reward logic should be handled in only one of them, typically by checking a flag like
shouldAlwaysRewardUser()
to avoid granting the reward twice.
loadedRewardedAd.show( activity, new ShowConfiguration.Builder().build(), new RewardedShowListener(){@Overridepublic void onStarted(@NonNull RewardedAd ad) { /* displayed */ }@Overridepublic void onClicked(@NonNull RewardedAd ad) { /* clicked */ }@Overridepublic void onRewarded(@NonNull RewardedAd ad){ if ( !shouldAlwaysRewardUser() ) { listener.onUserRewarded(getReward()); }}@Overridepublic void onCompleted(@NonNull RewardedAd ad, @NonNull ShowFinishState state){ if ( shouldAlwaysRewardUser() ) { listener.onUserRewarded(getReward()); } listener.onRewardedAdHidden();}@Overridepublic void onFailed(@NonNull RewardedAd ad, @NonNull UnityAdsError error) { /* failed */ }} );

Rewarded video ad show example

rewardedAd.show(activity, showConfig, rewardedAdShowListener){ @Override public void onStarted(@NonNull InterstitialAd ad) { /* displayed */ } @Override public void onClicked(@NonNull InterstitialAd ad) { /* clicked */ } @Override public void onCompleted(@NonNull InterstitialAd ad, @NonNull ShowFinishState state) { /* hidden */ } @Override public void onFailed(@NonNull InterstitialAd ad, @NonNull UnityAdsError error) { /* failed */ } }
Next steps: Refer to Implement banner ads in Android.