-
- All Implemented Interfaces:
public 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 final static Unitinitialize(Context context, String gameId)Initializes Unity Ads. final static Unitinitialize(Context context, String gameId, IUnityAdsInitializationListener initializationListener)Initializes Unity Ads. final static Unitinitialize(Context context, String gameId, Boolean testMode)Initializes Unity Ads. final static Unitinitialize(Context context, String gameId, Boolean testMode, IUnityAdsInitializationListener initializationListener)Initializes Unity Ads. final static Unitshow(Activity activity, String placementId)Show one advertisement with custom placement. final static Unitshow(Activity activity, String placementId, IUnityAdsShowListener showListener)Show one advertisement with custom placement and custom options. final static Unitshow(Activity activity, String placementId, UnityAdsShowOptions options)Show one advertisement with custom placement and custom options. final static Unitshow(Activity activity, String placementId, UnityAdsShowOptions options, IUnityAdsShowListener showListener)Show one advertisement with custom placement and custom options. final static Unitload(String placementId)Request fill for a specific placement ID. final static Unitload(String placementId, IUnityAdsLoadListener listener)Request fill for a specific placement ID. final static Unitload(String placementId, UnityAdsLoadOptions loadOptions, IUnityAdsLoadListener listener)Request fill for a specific placement ID with custom options. final static UnitgetToken(IUnityAdsTokenListener listener)Get request token in asynchronous way. final static BooleangetIsInitialized()Checks if Unity Ads has been initialized. final static BooleangetIsSupported()Checks if current device supports running Unity Ads final static StringgetVersion()Get current SDK version final static BooleangetDebugMode()Get current debug mode status final static UnitsetDebugMode(static Boolean debugMode)Toggles debug mode on/off final static StringgetToken()Get request token. -
-
Method Detail
-
initialize
final static Unit 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
final static Unit 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
final static Unit 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
final static Unit 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
-
show
@Deprecated(message = "") final static Unit 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
final static Unit 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(message = "") final static Unit 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
final static Unit 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
-
load
@Deprecated(message = "") final static Unit load(String placementId)
Request fill for a specific placement ID.
- Parameters:
placementId- The placement ID to be loaded.
-
load
final static Unit 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
final static Unit 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
final static Unit getToken(IUnityAdsTokenListener listener)
Get request token in asynchronous way.
-
getIsInitialized
final static Boolean getIsInitialized()
Checks if Unity Ads has been initialized. This might be useful for debugging initialization problems.
-
getIsSupported
final static Boolean getIsSupported()
Checks if current device supports running Unity Ads
-
getVersion
final static String getVersion()
Get current SDK version
-
getDebugMode
final static Boolean getDebugMode()
Get current debug mode status
-
setDebugMode
final static Unit setDebugMode(static 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.
-
-
-
-