public final class UnityAds
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
UnityAds.FinishState
An enumeration for the completion state of an ad.
|
static class |
UnityAds.PlacementState
Describes state of Unity Ads placements.
|
static class |
UnityAds.UnityAdsError |
static class |
UnityAds.UnityAdsInitializationError
Enumeration of UnityAds initialization errors.
|
static class |
UnityAds.UnityAdsLoadError
Enumeration of UnityAds load errors.
|
static class |
UnityAds.UnityAdsShowCompletionState |
static class |
UnityAds.UnityAdsShowError
Enumeration of UnityAds show errors.
|
| Constructor and Description |
|---|
UnityAds() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addListener(IUnityAdsListener listener)
Add listener for IUnityAdsListener callbacks.
|
static boolean |
getDebugMode()
Get current debug mode status
|
static IUnityAdsListener |
getListener()
Deprecated.
this method is deprecated in favor of
addListener(IUnityAdsListener) and removeListener(IUnityAdsListener) |
static UnityAds.PlacementState |
getPlacementState()
Get current state of default placement
|
static UnityAds.PlacementState |
getPlacementState(java.lang.String placementId)
Get current state of a placement
|
static java.lang.String |
getToken()
Get request token.
|
static java.lang.String |
getVersion()
Get current SDK version
|
static void |
initialize(android.app.Activity activity,
java.lang.String gameId)
Deprecated.
this method is deprecated in favor of
initialize(Context, String) use Application Context |
static void |
initialize(android.app.Activity activity,
java.lang.String gameId,
boolean testMode)
Deprecated.
this method is deprecated in favor of
initialize(Context, String, boolean) use Application Context |
static void |
initialize(android.app.Activity activity,
java.lang.String gameId,
boolean testMode,
boolean enablePerPlacementLoad)
Deprecated.
this method is deprecated in favor of
initialize(Context, String, boolean, boolean) use Application Context |
static void |
initialize(android.app.Activity activity,
java.lang.String gameId,
boolean testMode,
boolean enablePerPlacementLoad,
IUnityAdsInitializationListener initializationListener)
Deprecated.
this method is deprecated in favor of
initialize(Context, String, boolean, boolean, IUnityAdsInitializationListener) use Application Context |
static void |
initialize(android.app.Activity activity,
java.lang.String gameId,
boolean testMode,
IUnityAdsInitializationListener initializationListener)
Deprecated.
this method is deprecated in favor of
initialize(Context, String, boolean, IUnityAdsInitializationListener) use Application context |
static void |
initialize(android.app.Activity activity,
java.lang.String gameId,
IUnityAdsInitializationListener initializationListener)
Deprecated.
this method is deprecated in favor of
initialize(Context, String, IUnityAdsInitializationListener) use Application Context |
static void |
initialize(android.app.Activity activity,
java.lang.String gameId,
IUnityAdsListener listener)
Deprecated.
this method is deprecated in favor of
initialize(Context, String) use addListener(IUnityAdsListener) to add a listener and use Application Context |
static void |
initialize(android.app.Activity activity,
java.lang.String gameId,
IUnityAdsListener listener,
boolean testMode)
Deprecated.
this method is deprecated in favor of
initialize(Context, String, boolean) use addListener(IUnityAdsListener) to add a listener and use Application Context |
static void |
initialize(android.app.Activity activity,
java.lang.String gameId,
IUnityAdsListener listener,
boolean testMode,
boolean enablePerPlacementLoad)
Deprecated.
this method is deprecated in favor of
initialize(Context, String, boolean, boolean) use addListener(IUnityAdsListener) to add a listener and use Application Context |
static void |
initialize(android.content.Context context,
java.lang.String gameId)
Initializes Unity Ads.
|
static void |
initialize(android.content.Context context,
java.lang.String gameId,
boolean testMode)
Initializes Unity Ads.
|
static void |
initialize(android.content.Context context,
java.lang.String gameId,
boolean testMode,
boolean enablePerPlacementLoad)
Initializes Unity Ads.
|
static void |
initialize(android.content.Context context,
java.lang.String gameId,
boolean testMode,
boolean enablePerPlacementLoad,
IUnityAdsInitializationListener initializationListener)
Initializes Unity Ads.
|
static void |
initialize(android.content.Context context,
java.lang.String gameId,
boolean testMode,
IUnityAdsInitializationListener initializationListener)
Initializes Unity Ads.
|
static void |
initialize(android.content.Context context,
java.lang.String gameId,
IUnityAdsInitializationListener initializationListener)
Initializes Unity Ads.
|
static boolean |
isInitialized()
Checks if Unity Ads has been initialized.
|
static boolean |
isReady()
Deprecated.
Please migrate to using load call with
IUnityAdsLoadListener. |
static boolean |
isReady(java.lang.String placementId)
Deprecated.
Please migrate to using load call with
IUnityAdsLoadListener. |
static boolean |
isSupported()
Checks if current device supports running Unity Ads
|
static void |
load(java.lang.String placementId)
Deprecated.
|
static void |
load(java.lang.String placementId,
IUnityAdsLoadListener listener)
Request fill for a specific placement ID.
|
static void |
load(java.lang.String placementId,
UnityAdsLoadOptions loadOptions,
IUnityAdsLoadListener listener)
Request fill for a specific placement ID with custom options.
|
static void |
removeListener(IUnityAdsListener listener)
Remove listener for IUnityAdsListener callbacks
|
static void |
setDebugMode(boolean debugMode)
Toggles debug mode on/off
|
static void |
setListener(IUnityAdsListener listener)
Deprecated.
this method is deprecated in favor of
addListener(IUnityAdsListener) |
static void |
show(android.app.Activity activity)
Deprecated.
|
static void |
show(android.app.Activity activity,
java.lang.String placementId)
Deprecated.
|
static void |
show(android.app.Activity activity,
java.lang.String placementId,
IUnityAdsShowListener showListener)
Show one advertisement with custom placement and custom options.
|
static void |
show(android.app.Activity activity,
java.lang.String placementId,
UnityAdsShowOptions options)
Deprecated.
|
static void |
show(android.app.Activity activity,
java.lang.String placementId,
UnityAdsShowOptions options,
IUnityAdsShowListener showListener)
Show one advertisement with custom placement and custom options.
|
@Deprecated
public static void initialize(android.app.Activity activity,
java.lang.String gameId,
IUnityAdsListener listener)
initialize(Context, String) use addListener(IUnityAdsListener) to add a listener and use Application Contextactivity - Current Android activity of calling appgameId - Unique identifier for a game, given by Unity Ads admin tools or Unity editorlistener - Listener for IUnityAdsListener callbacks@Deprecated
public static void initialize(android.app.Activity activity,
java.lang.String gameId)
initialize(Context, String) use Application Contextactivity - Current Android activity of calling appgameId - Unique identifier for a game, given by Unity Ads admin tools or Unity editor@Deprecated
public static void initialize(android.app.Activity activity,
java.lang.String gameId,
IUnityAdsInitializationListener initializationListener)
initialize(Context, String, IUnityAdsInitializationListener) use Application Contextactivity - Current Android activity of calling appgameId - Unique identifier for a game, given by Unity Ads admin tools or Unity editorinitializationListener - Listener for IUnityAdsInitializationListener callbacks@Deprecated
public static void initialize(android.app.Activity activity,
java.lang.String gameId,
IUnityAdsListener listener,
boolean testMode)
initialize(Context, String, boolean) use addListener(IUnityAdsListener) to add a listener and use Application Contextactivity - Current Android activity of calling appgameId - Unique identifier for a game, given by Unity Ads admin tools or Unity editorlistener - Listener for IUnityAdsListener callbackstestMode - If true, only test ads are shown@Deprecated
public static void initialize(android.app.Activity activity,
java.lang.String gameId,
boolean testMode)
initialize(Context, String, boolean) use Application Contextactivity - Current Android activity of calling appgameId - Unique identifier for a game, given by Unity Ads admin tools or Unity editortestMode - If true, only test ads are shown@Deprecated
public static void initialize(android.app.Activity activity,
java.lang.String gameId,
boolean testMode,
IUnityAdsInitializationListener initializationListener)
initialize(Context, String, boolean, IUnityAdsInitializationListener) use Application contextactivity - Current Android activity of calling appgameId - 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@Deprecated
public static void initialize(android.app.Activity activity,
java.lang.String gameId,
IUnityAdsListener listener,
boolean testMode,
boolean enablePerPlacementLoad)
initialize(Context, String, boolean, boolean) use addListener(IUnityAdsListener) to add a listener and use Application Contextactivity - Current Android activity of calling appgameId - Unique identifier for a game, given by Unity Ads admin tools or Unity editorlistener - Listener for IUnityAdsListener callbackstestMode - If true, only test ads are shownenablePerPlacementLoad - Set this flag to `YES` to disable automatic placement caching. When this is enabled, developer must call `load` on placements before calling show@Deprecated
public static void initialize(android.app.Activity activity,
java.lang.String gameId,
boolean testMode,
boolean enablePerPlacementLoad)
initialize(Context, String, boolean, boolean) use Application Contextactivity - Current Android activity of calling appgameId - Unique identifier for a game, given by Unity Ads admin tools or Unity editortestMode - If true, only test ads are shownenablePerPlacementLoad - Set this flag to `YES` to disable automatic placement caching. When this is enabled, developer must call `load` on placements before calling show@Deprecated
public static void initialize(android.app.Activity activity,
java.lang.String gameId,
boolean testMode,
boolean enablePerPlacementLoad,
IUnityAdsInitializationListener initializationListener)
initialize(Context, String, boolean, boolean, IUnityAdsInitializationListener) use Application Contextactivity - Current Android activity of calling appgameId - Unique identifier for a game, given by Unity Ads admin tools or Unity editortestMode - If true, only test ads are shownenablePerPlacementLoad - Set this flag to `YES` to disable automatic placement caching. When this is enabled, developer must call `load` on placements before calling showinitializationListener - Listener for IUnityAdsInitializationListener callbackspublic static void initialize(android.content.Context context,
java.lang.String gameId)
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 editorpublic static void initialize(android.content.Context context,
java.lang.String gameId,
IUnityAdsInitializationListener initializationListener)
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 callbackspublic static void initialize(android.content.Context context,
java.lang.String gameId,
boolean testMode)
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 shownpublic static void initialize(android.content.Context context,
java.lang.String gameId,
boolean testMode,
IUnityAdsInitializationListener initializationListener)
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 callbackspublic static void initialize(android.content.Context context,
java.lang.String gameId,
boolean testMode,
boolean enablePerPlacementLoad)
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 shownenablePerPlacementLoad - Set this flag to `YES` to disable automatic placement caching. When this is enabled, developer must call `load` on placements before calling showpublic static void initialize(android.content.Context context,
java.lang.String gameId,
boolean testMode,
boolean enablePerPlacementLoad,
IUnityAdsInitializationListener initializationListener)
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 shownenablePerPlacementLoad - Set this flag to `YES` to disable automatic placement caching. When this is enabled, developer must call `load` on placements before calling showinitializationListener - Listener for IUnityAdsInitializationListener callbackspublic static boolean isInitialized()
@Deprecated public static void setListener(IUnityAdsListener listener)
addListener(IUnityAdsListener)listener - New listener for IUnityAdsListener callbacks@Deprecated public static IUnityAdsListener getListener()
addListener(IUnityAdsListener) and removeListener(IUnityAdsListener)public static void addListener(IUnityAdsListener listener)
listener - New listener for IUnityAdsListener callbackspublic static void removeListener(IUnityAdsListener listener)
listener - New listener for IUnityAdsListener callbackspublic static boolean isSupported()
public static java.lang.String getVersion()
@Deprecated public static boolean isReady()
IUnityAdsLoadListener.@Deprecated public static boolean isReady(java.lang.String placementId)
IUnityAdsLoadListener.placementId - Placement, as defined in Unity Ads admin toolspublic static UnityAds.PlacementState getPlacementState()
public static UnityAds.PlacementState getPlacementState(java.lang.String placementId)
placementId - Placement, as defined in Unity Ads admin tools@Deprecated public static void show(android.app.Activity activity)
activity - Current Android activity of calling app@Deprecated
public static void show(android.app.Activity activity,
java.lang.String placementId)
activity - Current Android activity of calling appplacementId - Placement, as defined in Unity Ads admin toolspublic static void show(android.app.Activity activity,
java.lang.String placementId,
IUnityAdsShowListener showListener)
activity - Current Android activity of calling appplacementId - Placement, as defined in Unity Ads admin toolsshowListener - Listener for IUnityAdsShowListener callbacks@Deprecated
public static void show(android.app.Activity activity,
java.lang.String placementId,
UnityAdsShowOptions options)
activity - Current Android activity of calling appplacementId - Placement, as defined in Unity Ads admin toolsoptions - Custom optionspublic static void show(android.app.Activity activity,
java.lang.String placementId,
UnityAdsShowOptions options,
IUnityAdsShowListener showListener)
activity - Current Android activity of calling appplacementId - Placement, as defined in Unity Ads admin toolsoptions - Custom optionsshowListener - Listener for IUnityAdsShowListener callbackspublic static void setDebugMode(boolean debugMode)
debugMode - If true, debug mode is on and there will be lots of debug output from Unity Ads. If false, there will be only some short log messages from Unity Ads.public static boolean getDebugMode()
@Deprecated public static void load(java.lang.String placementId)
placementId - The placement ID to be loaded.public static void load(java.lang.String placementId,
IUnityAdsLoadListener listener)
placementId - The placement ID to be loaded.listener - The listener which is going to be notified about load request result.public static void load(java.lang.String placementId,
UnityAdsLoadOptions loadOptions,
IUnityAdsLoadListener listener)
placementId - The placement ID to be loaded.loadOptions - Custom options.listener - The listener which is going to be notified about load request result.public static java.lang.String getToken()