Package com.adcolony.sdk
Class AdColony
- java.lang.Object
-
- com.adcolony.sdk.AdColony
-
public class AdColony extends java.lang.ObjectContains static, public API methods.
-
-
Constructor Summary
Constructors Constructor Description AdColony()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleanaddCustomMessageListener(AdColonyCustomMessageListener listener, java.lang.String type)Call this method to set the AdColonyCustomMessageListener for custom message events in your app.static booleanclearCustomMessageListeners()Used to clear all currently registered AdColonyCustomMessageListeners.static java.lang.StringcollectSignals()Deprecated.static voidcollectSignals(AdColonySignalsListener listener)Gathers AdColony specific information to be passed into OpenRTB bid requests from a mediation setting.static booleanconfigure(Activity activity, AdColonyAppOptions options, java.lang.String appId)Configures AdColony to play ads in your app.static booleanconfigure(Activity activity, AdColonyAppOptions options, java.lang.String appId, java.lang.String... zoneIds)Deprecated.Use overload without zoneIdsstatic booleanconfigure(Activity activity, java.lang.String appId)Configures AdColony to play ads in your app.static booleanconfigure(Activity activity, java.lang.String appId, java.lang.String... zoneIds)Deprecated.Use overload without zoneIdsstatic booleanconfigure(Application app, AdColonyAppOptions options, java.lang.String appId)Configures AdColony to play ads in your app.static booleanconfigure(Application app, AdColonyAppOptions options, java.lang.String appId, java.lang.String... zoneIds)Deprecated.Use overload without zoneIdsstatic booleanconfigure(Application app, java.lang.String appId)Configures AdColony to play ads in your app.static booleanconfigure(Application app, java.lang.String appId, java.lang.String... zoneIds)Deprecated.Use overload without zoneIdsstatic booleandisable()Disables AdColony from requesting and showing ads and destroys any existing VM modules for the rest of the app session.static AdColonyAppOptionsgetAppOptions()Used to retrieve the currently set app options for this session.static AdColonyCustomMessageListenergetCustomMessageListener(java.lang.String type)Used to retrieve the currently registered AdColonyCustomMessageListener.static AdColonyRewardListenergetRewardListener()Used to retrieve the global reward listener for this app session.static java.lang.StringgetSDKVersion()Used to retrieve the version String of the AdColony SDK.static AdColonyZonegetZone(java.lang.String zoneId)Getter for AdColonyZone objects.static booleannotifyIAPComplete(java.lang.String productId, java.lang.String transId)Used to provide AdColony with IAP information.static booleannotifyIAPComplete(java.lang.String productId, java.lang.String transId, java.lang.String currencyCode, double price)Used to provide AdColony with IAP information.static booleanremoveCustomMessageListener(java.lang.String type)Used to remove a specific AdColonyCustomMessageListener.static booleanremoveRewardListener()Removes the internal reference to the reward listener to allow for collection.static booleanrequestAdView(java.lang.String zoneId, AdColonyAdViewListener listener, AdColonyAdSize size)Asynchronous request for an AdColonyAdView object (returned to the user via the AdColonyInterstitialListener).static booleanrequestAdView(java.lang.String zoneId, AdColonyAdViewListener listener, AdColonyAdSize size, AdColonyAdOptions options)static booleanrequestInterstitial(java.lang.String zoneId, AdColonyInterstitialListener listener)Call this method to request an interstitial advertisement.static booleanrequestInterstitial(java.lang.String zoneId, AdColonyInterstitialListener listener, AdColonyAdOptions options)Call this method to request an interstitial advertisement.static booleansetAppOptions(AdColonyAppOptions options)Used to update/replace app options at runtime.static booleansetRewardListener(AdColonyRewardListener listener)Call this method to set the AdColonyRewardListener for global reward callbacks for your app.
-
-
-
Method Detail
-
disable
public static boolean disable()
Disables AdColony from requesting and showing ads and destroys any existing VM modules for the rest of the app session.- Returns:
- whether or not the command was successful. Will return false if AdColony has not yet been configured.
-
collectSignals
public static void collectSignals(AdColonySignalsListener listener)
Gathers AdColony specific information to be passed into OpenRTB bid requests from a mediation setting.- Parameters:
listener- TheAdColonySignalsListenerto be notified of success/failure.
-
collectSignals
@Deprecated public static java.lang.String collectSignals()
Deprecated.Gathers AdColony specific information to be passed into OpenRTB bid requests from a mediation setting.- Returns:
- the String to be passed into OpenRTB bid requests, or an empty String if AdColony has not yet been configured.
-
configure
@Deprecated public static boolean configure(Activity activity, java.lang.String appId, java.lang.String... zoneIds)Deprecated.Use overload without zoneIdsConfigures AdColony to play ads in your app.- Parameters:
activity- the activity that the configure request is called from.appId- your app identifier gathered from the AdColony dashboard.zoneIds- unused- Returns:
- whether or not the command was successful. Will return false if subsequent calls to this method use a new app id, or if the app id is empty.
-
configure
@Deprecated public static boolean configure(Activity activity, AdColonyAppOptions options, java.lang.String appId, java.lang.String... zoneIds)Deprecated.Use overload without zoneIdsConfigures AdColony to play ads in your app.- Parameters:
activity- the activity that the configure request is called from.options- the optional AdColonyAppOptions object to be sent.appId- your app identifier gathered from the AdColony dashboard.zoneIds- unused- Returns:
- whether or not the command was successful. Will return false if subsequent calls to this method use a new app id, or if the app id is empty.
-
configure
@Deprecated public static boolean configure(Application app, java.lang.String appId, java.lang.String... zoneIds)Deprecated.Use overload without zoneIdsConfigures AdColony to play ads in your app.- Parameters:
app- the app that the configure request is called from.appId- your app identifier gathered from the AdColony dashboard.zoneIds- unused- Returns:
- whether or not the command was successful. Will return false if subsequent calls to this method use a new app id, or if the app id is empty.
-
configure
@Deprecated public static boolean configure(Application app, AdColonyAppOptions options, java.lang.String appId, java.lang.String... zoneIds)Deprecated.Use overload without zoneIdsConfigures AdColony to play ads in your app. Use this signature if you wish to pass along anAdColonyAppOptionsobject to AdColony.- Parameters:
app- the Application that the configure request is called from.options- the optional AdColonyAppOptions object to be sent.appId- your app identifier gathered from the AdColony dashboard.zoneIds- unused- Returns:
- whether or not the command was successful. Will return false if subsequent calls to this method use a new app id, or if the app id is empty.
- See Also:
AdColonyAppOptions
-
configure
public static boolean configure(Activity activity, java.lang.String appId)Configures AdColony to play ads in your app.- Parameters:
activity- the activity that the configure request is called from.appId- your app identifier gathered from the AdColony dashboard.- Returns:
- whether or not the command was successful. Will return false if subsequent calls to this method use a new app id, or if the app id is empty.
-
configure
public static boolean configure(Activity activity, AdColonyAppOptions options, java.lang.String appId)Configures AdColony to play ads in your app.- Parameters:
activity- the activity that the configure request is called from.options- the optional AdColonyAppOptions object to be sent.appId- your app identifier gathered from the AdColony dashboard.- Returns:
- whether or not the command was successful. Will return false if subsequent calls to this method use a new app id, or if the app id is empty.
-
configure
public static boolean configure(Application app, java.lang.String appId)Configures AdColony to play ads in your app.- Parameters:
app- the app that the configure request is called from.appId- your app identifier gathered from the AdColony dashboard.- Returns:
- whether or not the command was successful. Will return false if subsequent calls to this method use a new app id, or if the app id is empty.
-
configure
public static boolean configure(Application app, AdColonyAppOptions options, java.lang.String appId)Configures AdColony to play ads in your app. Use this signature if you wish to pass along anAdColonyAppOptionsobject to AdColony.- Parameters:
app- the Application that the configure request is called from.options- the optional AdColonyAppOptions object to be sent.appId- your app identifier gathered from the AdColony dashboard.- Returns:
- whether or not the command was successful. Will return false if subsequent calls to this method use a new app id, or if the app id is empty.
- See Also:
AdColonyAppOptions
-
getZone
public static AdColonyZone getZone(java.lang.String zoneId)
Getter for AdColonyZone objects.- Parameters:
zoneId- the String zone id representing the zone you want information about.- Returns:
- the AdColonyZone object from which to get further information, or null if AdColony has not yet been configured.
- See Also:
AdColonyZone
-
notifyIAPComplete
public static boolean notifyIAPComplete(java.lang.String productId, java.lang.String transId)Used to provide AdColony with IAP information.- Parameters:
productId- the product id for the item that was purchased.transId- the transaction id for the item that was purchased.- Returns:
- whether or not the command was successful. Will return false if AdColony has not yet been configured, if required parameters are null, or if the Strings are greater than 128 characters.
-
notifyIAPComplete
public static boolean notifyIAPComplete(java.lang.String productId, java.lang.String transId, java.lang.String currencyCode, double price)Used to provide AdColony with IAP information.- Parameters:
productId- the product id for the item that was purchased.transId- the transaction id for the item that was purchased.currencyCode- an optional currency code for the price.price- an optional price for the item that was purchased.- Returns:
- whether or not the command was successful. Will return false if AdColony has not yet been configured or if the Strings are greater than 128 characters.
-
requestAdView
public static boolean requestAdView(java.lang.String zoneId, AdColonyAdViewListener listener, AdColonyAdSize size)Asynchronous request for an AdColonyAdView object (returned to the user via the AdColonyInterstitialListener). Used for any non-fullscreen ad unit.- Parameters:
zoneId- the AdColony zone id from which to request the adlistener- the AdColonyInterstitialListener to be notified upon successful/unsuccessful requestsize- the AdColonyAdSize object representing the desired width/height of the ad view.- Returns:
- whether or not the request was made. Will return false if AdColony is disabled.
- See Also:
AdColonyInterstitialListener
-
requestAdView
public static boolean requestAdView(java.lang.String zoneId, AdColonyAdViewListener listener, AdColonyAdSize size, AdColonyAdOptions options)- Parameters:
zoneId- the AdColony zone id from which to request the ad.listener- the AdColonyAdViewListener to be notified upon successful/unsuccessful request.size- the AdColonySize object representing the desired width/height of the ad view.options- the optional options object to be passed along with this request.- Returns:
- whether or not the request was made. Will return false if AdColony is disabled.
-
setAppOptions
public static boolean setAppOptions(AdColonyAppOptions options)
Used to update/replace app options at runtime.- Parameters:
options- the new AdColonyAppOptions object to be set.- Returns:
- whether or not the command was successful. Will only be false if AdColony has not yet been configured.
- See Also:
AdColonyAppOptions
-
getAppOptions
public static AdColonyAppOptions getAppOptions()
Used to retrieve the currently set app options for this session.- Returns:
- the current app options for the session, or null if AdColony has not been configured.
-
setRewardListener
public static boolean setRewardListener(AdColonyRewardListener listener)
Call this method to set the AdColonyRewardListener for global reward callbacks for your app.- Parameters:
listener- the AdColonyRewardListener object to register.- Returns:
- whether or not the command was successful. Will return false if AdColony is not yet configured.
- See Also:
AdColonyReward,AdColonyRewardListener
-
removeRewardListener
public static boolean removeRewardListener()
Removes the internal reference to the reward listener to allow for collection.- Returns:
- whether or not the command was successful. Will return false if AdColony is not configured.
-
getSDKVersion
public static java.lang.String getSDKVersion()
Used to retrieve the version String of the AdColony SDK.- Returns:
- the AdColony SDK's version String. Will return an empty String if AdColony has not yet been configured.
-
getRewardListener
public static AdColonyRewardListener getRewardListener()
Used to retrieve the global reward listener for this app session.- Returns:
- the current reward listener, or null if none has been set or if AdColony has not yet been configured.
-
addCustomMessageListener
public static boolean addCustomMessageListener(AdColonyCustomMessageListener listener, java.lang.String type)
Call this method to set the AdColonyCustomMessageListener for custom message events in your app.- Parameters:
listener- the AdColonyCustomMessageListener to register.type- the type of message to listen for.- Returns:
- whether or not the command was successful. Will return false only if AdColony has not yet been configured.
- See Also:
AdColonyCustomMessage,AdColonyCustomMessageListener
-
getCustomMessageListener
public static AdColonyCustomMessageListener getCustomMessageListener(java.lang.String type)
Used to retrieve the currently registered AdColonyCustomMessageListener.- Parameters:
type- the type of the message listener to retrieve.- Returns:
- the currently registered AdColonyCustomMessageListener, or null if AdColony has not yet been configured or if there is no listener set.
-
removeCustomMessageListener
public static boolean removeCustomMessageListener(java.lang.String type)
Used to remove a specific AdColonyCustomMessageListener.- Parameters:
type- the type of listener to remove.- Returns:
- whether or not the command was successful. Will return false if AdColony has not yet been configured.
-
clearCustomMessageListeners
public static boolean clearCustomMessageListeners()
Used to clear all currently registered AdColonyCustomMessageListeners.- Returns:
- whether or not the command was successful. Will return false if AdColony has not yet been configured.
-
requestInterstitial
public static boolean requestInterstitial(java.lang.String zoneId, AdColonyInterstitialListener listener)Call this method to request an interstitial advertisement. A successfully filled request will return an ad via the listener'sAdColonyInterstitialListener.onRequestFilled(AdColonyInterstitial)callback. A request that was not filled will trigger the listener'sAdColonyInterstitialListener.onRequestNotFilled(AdColonyZone)callback.- Parameters:
zoneId- the zone identifier of the zone you wish to request an interstitial advertisement from.listener- the listener object to be alerted in response to the request.- Returns:
- whether or not the command was completed successfully. Will return false if AdColony has not yet been configured.
- See Also:
AdColonyInterstitialListener
-
requestInterstitial
public static boolean requestInterstitial(java.lang.String zoneId, AdColonyInterstitialListener listener, AdColonyAdOptions options)Call this method to request an interstitial advertisement. A successfully filled request will return an ad via the listener'sAdColonyInterstitialListener.onRequestFilled(AdColonyInterstitial)callback. A request that was not filled will trigger the listener'sAdColonyInterstitialListener.onRequestNotFilled(AdColonyZone zone)callback.- Parameters:
zoneId- the zone identifier of the zone you wish to request an interstitial advertisement from.listener- the listener object to be alerted in response to the request.options- the optional ad options to be sent along with this request.- Returns:
- whether or not the command was completed successfully. Will return false if AdColony has not yet been configured.
- See Also:
AdColonyInterstitialListener,AdColonyAdOptions
-
-