Documentation

Development

User Acquisition

Monetization

Industry

Unity Ads Monetization

Unity Ads Android SDK

Unity Ads iOS SDK

Unity Ads SDK

Unity Ads Monetization

Unity Ads Monetization
​
​
Android developer guide
  • Android SDK overview
  • Integration requirements
  • Install the Unity Ads SDK for Android
  • Initialize the SDK in Android
  • Implement interstitial ads in Android
  • Implement rewarded ads in Android
  • Implement banner ads in Android
Android SDK API reference
  • Unity Ads for Android API reference (Java)
  1. Grow your game
  2. Unity Ads
  3. Unity Ads SDK integration guide for Android developers

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 4 minutes
Last updated 6 months 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.
To reward users for completing a video ad, use the
IUnityAdsShowListener.onUnityAdsShowComplete
listener callback method's
UnityAdsShowCompletionState
result to check if the user finished watching the ad and should be rewarded.
Note
Unity Ads requires access to the currently running Activity, so the following example uses
getApplicationContext()
. Because this might not be suitable for all implementations, some customization might be required (depending on the integration).

Rewarded video ad example

import android.app.Activity; import android.os.Bundle; import android.util.Log; import androidx.appcompat.app.AppCompatActivity; import com.unity3d.ads.IUnityAdsLoadListener; import com.unity3d.ads.IUnityAdsShowListener; import com.unity3d.ads.UnityAdsShowOptions; import com.unity3d.ads.example.R; import com.unity3d.ads.IUnityAdsInitializationListener; import com.unity3d.ads.UnityAds; public class ShowRewardedAd extends AppCompatActivity implements IUnityAdsInitializationListener { private String unityGameID = "1234567"; private Boolean testMode = true; private String adUnitId = "rewardedVideo"; private IUnityAdsLoadListener loadListener = new IUnityAdsLoadListener() { @Override public void onUnityAdsAdLoaded(String placementId) { UnityAds.show((Activity)getApplicationContext(), adUnitId, new UnityAdsShowOptions(), showListener); } @Override public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { Log.e("UnityAdsExample", "Unity Ads failed to load ad for " + placementId + " with error: [" + error + "] " + message); } }; private IUnityAdsShowListener showListener = new IUnityAdsShowListener() { @Override public void onUnityAdsShowFailure(String placementId, UnityAds.UnityAdsShowError error, String message) { Log.e("UnityAdsExample", "Unity Ads failed to show ad for " + placementId + " with error: [" + error + "] " + message); } @Override public void onUnityAdsShowStart(String placementId) { Log.v("UnityAdsExample", "onUnityAdsShowStart: " + placementId); } @Override public void onUnityAdsShowClick(String placementId) { Log.v("UnityAdsExample", "onUnityAdsShowClick: " + placementId); } @Override public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowCompletionState state) { Log.v("UnityAdsExample", "onUnityAdsShowComplete: " + placementId); if (state.equals(UnityAds.UnityAdsShowCompletionState.COMPLETED)) { // Reward the user for watching the ad to completion } else { // Do not reward the user for skipping the ad } } }; @Override protected void onCreate (Bundle savedInstanceState) { super.onCreate (savedInstanceState); setContentView (R.layout.activity_main); // Initialize the SDK: UnityAds.initialize(getApplicationContext(), unityGameID, testMode, this); } @Override public void onInitializationComplete() { DisplayRewardedAd(); } @Override public void onInitializationFailed(UnityAds.UnityAdsInitializationError error, String message) { Log.e("UnityAdsExample", "Unity Ads initialization failed with error: [" + error + "] " + message); } // Implement a function to load a rewarded ad. The ad will start to show after the ad has been loaded. public void DisplayRewardedAd () { UnityAds.load(adUnitId, loadListener); } }

Rewarded video ad buttons

Using a button to allow the player to opt in to watching an ad is a common implementation for rewarded video ads. Use the following example code to create a rewarded ads button. The ads button displays an ad when pressed, as long as an ad has loaded first. For information on configuring buttons, refer to the Android developer documentation on Buttons.
After you have implemented your button, add a script with the following code, where
showAdButton
is a button configured in the View:
Note
Unity Ads requires access to the currently running Activity, so the following example uses
getApplicationContext()
. Because this might not be suitable for all implementations, some customization might be required (depending on the integration).
import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import androidx.appcompat.app.AppCompatActivity; import com.unity3d.ads.IUnityAdsLoadListener; import com.unity3d.ads.IUnityAdsShowListener; import com.unity3d.ads.UnityAdsShowOptions; import com.unity3d.ads.example.R; import com.unity3d.ads.IUnityAdsInitializationListener; import com.unity3d.ads.UnityAds; public class RewardedAdButton extends AppCompatActivity implements IUnityAdsInitializationListener { private String unityGameID = "1234567"; private Boolean testMode = true; private String adUnitId = "rewardedVideo"; private Button rewardedButton; private IUnityAdsLoadListener loadListener = new IUnityAdsLoadListener() { @Override public void onUnityAdsAdLoaded(String placementId) { UnityAds.show((Activity)getApplicationContext(), adUnitId, new UnityAdsShowOptions(), showListener); } @Override public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) { Log.e("UnityAdsExample", "Unity Ads failed to load ad for " + placementId + " with error: [" + error + "] " + message); } }; private IUnityAdsShowListener showListener = new IUnityAdsShowListener() { @Override public void onUnityAdsShowFailure(String placementId, UnityAds.UnityAdsShowError error, String message) { Log.e("UnityAdsExample", "Unity Ads failed to show ad for " + placementId + " with error: [" + error + "] " + message); // Re-enable the button if the user should be allowed to watch another rewarded ad rewardedButton.setEnabled(true); } @Override public void onUnityAdsShowStart(String placementId) { Log.v("UnityAdsExample", "onUnityAdsShowStart: " + placementId); } @Override public void onUnityAdsShowClick(String placementId) { Log.v("UnityAdsExample", "onUnityAdsShowClick: " + placementId); } @Override public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowCompletionState state) { Log.v("UnityAdsExample", "onUnityAdsShowComplete: " + placementId); if (state.equals(UnityAds.UnityAdsShowCompletionState.COMPLETED)) { // Reward the user for watching the ad to completion } else { // Do not reward the user for skipping the ad } // Re-enable the button if the user should be allowed to watch another rewarded ad rewardedButton.setEnabled(true); } }; @Override protected void onCreate (Bundle savedInstanceState) { super.onCreate (savedInstanceState); setContentView (R.layout.activity_main); // Initialize the SDK: UnityAds.initialize(getApplicationContext(), unityGameID, testMode, this); // Find the button in the view hierarchy and set its click function to load ads: rewardedButton = findViewById (R.id.showAdButton); rewardedButton.setOnClickListener (new View.OnClickListener (){ @Override public void onClick (View v) { DisplayRewardedAd (); rewardedButton.setEnabled(false); } }); } @Override public void onInitializationComplete() { rewardedButton.setEnabled(true); } @Override public void onInitializationFailed(UnityAds.UnityAdsInitializationError error, String message) { Log.e("UnityAdsExample", "Unity Ads initialization failed with error: [" + error + "] " + message); } // Implement a function to load an rewarded ad. The ad will start to show after the ad has been loaded. public void DisplayRewardedAd () { UnityAds.load(adUnitId, loadListener); } }
Next steps: Refer to Implement banner ads in Android.

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.

  • On this page
    • Rewarded video ad example

    • Rewarded video ad buttons


Report a problem with this page
​
​