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

Initialize the SDK in Android

Initialize the Unity Ads SDK in your Android app. Set your Game ID and configure a listener to handle initialization status and enable ad monetization.
Read time 2 minutes
Last updated 4 months ago

To initialize the SDK, you must reference your Project's Game ID for the appropriate platform. You can locate the ID on the Unity Monetization Dashboard by selecting CURRENT PROJECT > Project Settings from the secondary navigation menu.
In your game script, you need to implement an
IUnityAdsInitializationListener
interface that handles initialization callbacks. The initialize method to initialize the SDK requires this listener as a parameter. Initialize the SDK early in your project's run-time life cycle before you need to load an ad. For example:
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).

SDK initialization example

import android.os.Bundle;import androidx.appcompat.app.AppCompatActivity;import com.unity3d.ads.example.R;import com.unity3d.ads.IUnityAdsInitializationListener;import com.unity3d.ads.UnityAds;public class InitializeAdsScript extends AppCompatActivity implements IUnityAdsInitializationListener { private String unityGameID = "1234567"; private Boolean testMode = true; @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() { } @Override public void onInitializationFailed(UnityAds.UnityAdsInitializationError error, String message) { }}
For the
initialize
function, the
context
parameter is the current Android
Context
. The
unityGameID
parameter is the Unity Game ID for your project, found in the Monetization dashboard, specifically the Settings page of your project. The
IUnityAdsInitializationListener
is the listener for the result of the initialization call. The
true
Boolean indicates that the game is in test mode, and will only show test ads.
Note
You must implement each of the callback methods in the listener interface, even if they are empty functions for now. You will populate them with the appropriate logic where needed in the following sections. For more information on each listener callback method, refer to the documentation on the
IUnityAdsInitializationListener
API.
Next steps: To continue your integration, refer to the Implement interstitial ads in Android documentation.

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
    • SDK initialization example


Report a problem with this page