-
- All Implemented Interfaces:
public final class UnityAds
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumUnityAds.UnityAdsShowCompletionStatepublic enumUnityAds.UnityAdsInitializationErrorEnumeration of UnityAds initialization errors.
public enumUnityAds.UnityAdsLoadErrorEnumeration of UnityAds load errors.
public enumUnityAds.UnityAdsShowErrorEnumeration of UnityAds show errors.
-
Method Summary
Modifier and Type Method Description static voidinitialize(Context context, String gameId)Initializes Unity Ads. static voidinitialize(Context context, String gameId, IUnityAdsInitializationListener initializationListener)Initializes Unity Ads. static voidinitialize(Context context, String gameId, boolean testMode)Initializes Unity Ads. static voidinitialize(Context context, String gameId, boolean testMode, IUnityAdsInitializationListener initializationListener)Initializes Unity Ads. static booleanisInitialized()Checks if Unity Ads has been initialized. static booleanisSupported()Checks if current device supports running Unity Ads static StringgetVersion()Get current SDK version static voidshow(Activity activity, String placementId)Show one advertisement with custom placement. static voidshow(Activity activity, String placementId, IUnityAdsShowListener showListener)Show one advertisement with custom placement and custom options. static voidshow(Activity activity, String placementId, UnityAdsShowOptions options)Show one advertisement with custom placement and custom options. static voidshow(Activity activity, String placementId, UnityAdsShowOptions options, IUnityAdsShowListener showListener)Show one advertisement with custom placement and custom options. static voidsetDebugMode(boolean debugMode)Toggles debug mode on/off static booleangetDebugMode()Get current debug mode status static voidload(String placementId)Request fill for a specific placement ID. static voidload(String placementId, IUnityAdsLoadListener listener)Request fill for a specific placement ID. static voidload(String placementId, UnityAdsLoadOptions loadOptions, IUnityAdsLoadListener listener)Request fill for a specific placement ID with custom options. static StringgetToken()Get request token. static voidgetToken(IUnityAdsTokenListener listener)Get request token in asynchronous way. -
-
Method Detail
-
initialize
static void initialize(Context context, String gameId)
Initializes Unity Ads. Unity Ads should be initialized when app starts.
- Parameters:
context- Current Android context of calling app in favor of Application ContextgameId- Unique identifier for a game, given by Unity Ads admin tools or Unity editor
-
initialize
static void initialize(Context context, String gameId, IUnityAdsInitializationListener initializationListener)
Initializes Unity Ads. Unity Ads should be initialized when app starts.
- Parameters:
context- Current Android context of calling app in favor of Application ContextgameId- Unique identifier for a game, given by Unity Ads admin tools or Unity editorinitializationListener- Listener for IUnityAdsInitializationListener callbacks
-
initialize
static void initialize(Context context, String gameId, boolean testMode)
Initializes Unity Ads. Unity Ads should be initialized when app starts.
- Parameters:
context- Current Android context of calling app in favor of Application ContextgameId- Unique identifier for a game, given by Unity Ads admin tools or Unity editortestMode- If true, only test ads are shown
-
initialize
static void initialize(Context context, String gameId, boolean testMode, IUnityAdsInitializationListener initializationListener)
Initializes Unity Ads. Unity Ads should be initialized when app starts.
- Parameters:
context- Current Android context of calling app in favor of Application ContextgameId- Unique identifier for a game, given by Unity Ads admin tools or Unity editortestMode- If true, only test ads are showninitializationListener- Listener for IUnityAdsInitializationListener callbacks
-
isInitialized
static boolean isInitialized()
Checks if Unity Ads has been initialized. This might be useful for debugging initialization problems.
-
isSupported
static boolean isSupported()
Checks if current device supports running Unity Ads
-
getVersion
static String getVersion()
Get current SDK version
-
show
@Deprecated() static void show(Activity activity, String placementId)
Show one advertisement with custom placement.
- Parameters:
activity- Current Android activity of calling appplacementId- Placement, as defined in Unity Ads admin tools
-
show
static void show(Activity activity, String placementId, IUnityAdsShowListener showListener)
Show one advertisement with custom placement and custom options.
- Parameters:
activity- Current Android activity of calling appplacementId- Placement, as defined in Unity Ads admin toolsshowListener- Listener for IUnityAdsShowListener callbacks
-
show
@Deprecated() static void show(Activity activity, String placementId, UnityAdsShowOptions options)
Show one advertisement with custom placement and custom options.
- Parameters:
activity- Current Android activity of calling appplacementId- Placement, as defined in Unity Ads admin toolsoptions- Custom options
-
show
static void show(Activity activity, String placementId, UnityAdsShowOptions options, IUnityAdsShowListener showListener)
Show one advertisement with custom placement and custom options.
- Parameters:
activity- Current Android activity of calling appplacementId- Placement, as defined in Unity Ads admin toolsoptions- Custom optionsshowListener- Listener for IUnityAdsShowListener callbacks
-
setDebugMode
static void setDebugMode(boolean debugMode)
Toggles debug mode on/off
- Parameters:
debugMode- If true, debug mode is on and there will be lots of debug output from Unity Ads.
-
getDebugMode
static boolean getDebugMode()
Get current debug mode status
-
load
@Deprecated() static void load(String placementId)
Request fill for a specific placement ID.
- Parameters:
placementId- The placement ID to be loaded.
-
load
static void load(String placementId, IUnityAdsLoadListener listener)
Request fill for a specific placement ID.
- Parameters:
placementId- The placement ID to be loaded.listener- The listener which is going to be notified about load request result.
-
load
static void load(String placementId, UnityAdsLoadOptions loadOptions, IUnityAdsLoadListener listener)
Request fill for a specific placement ID with custom options.
- Parameters:
placementId- The placement ID to be loaded.loadOptions- Custom options.listener- The listener which is going to be notified about load request result.
-
getToken
static void getToken(IUnityAdsTokenListener listener)
Get request token in asynchronous way.
-
-
-
-