Artenus 2D Framework
Artenus Reference
Superclass of unified ad managers. If a UnifiedServices implementation supports ads, it should provide a sub-class of this class.
public abstract class AdManager

Field Summary

Modifier and TypeField and Description
protected adLayout
Holds the ad layout managed by this ad manager.

Constructor Summary

Modifier and TypeConstructor and Description
public AdManager()

Method Summary

Modifier and TypeMethod and Description
public final voiddestroyAd()
Releases resources associated with the ad unit when it is no longer needed.
protected abstract voiddestroyAdView(View adView)
Implemented by subclasses to destroy a view corresponding to an ad unit.
public final intgetAdHeight()
Gets the height of the ad unit currently displayed.
protected StringgetAdUnitId()
Gets the currently assigned ad unit identifier.
protected abstract ViewgetAdView()
Implemented by subclasses to return a view corresponding to the ad unit overlay.
public final voidhideAd()
Hides the ad unit.
public final voidsetAdLayout(AdLayout adLayout)
Sets the game layout on which ads should be placed.
public final voidsetAdPlacementListener(AdPlacementListener listener)
Sets the listener that is responsible for handling ad placement events.
public voidsetAdUnitId(String adUnitId)
Sets the identifier for the ad unit that should be displayed over the stage by this ad manager.
public final voidshowAd(AdManager.Placements show)
Hides or displays the ad unit at a specified location.

Methods inherited from java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

adLayout
protected adLayout
Holds the ad layout managed by this ad manager.

Constructor Detail

AdManager
public  AdManager()

Method Detail

destroyAd
public final void destroyAd()
Releases resources associated with the ad unit when it is no longer needed. An example of a situation where this method needs to be called is when the user buys the full version of the app using IAP, and ads need to be removed.
destroyAdView
protected abstract void destroyAdView(
    View adView
)
Implemented by subclasses to destroy a view corresponding to an ad unit. Subclasses usually do not need to do type checking, as the framework only passes ad units created by the same instance as the argument.
Parameters:
adViewThe ad view previously created by this ad manager
getAdHeight
public final int getAdHeight()
Gets the height of the ad unit currently displayed.
Returns:
The height of the ad unit in pixels, or 0 if it is not present
getAdUnitId
protected String getAdUnitId()
Gets the currently assigned ad unit identifier.
Returns:
Ad unit identifier
getAdView
protected abstract View getAdView()
Implemented by subclasses to return a view corresponding to the ad unit overlay. The exact sub-type of the returned View depends on the specific implementation.
Returns:
The ad view
hideAd
public final void hideAd()
Hides the ad unit. This is the same as calling showAd(Placements) with the HIDDEN option.
setAdLayout
public final void setAdLayout(
    AdLayout adLayout
)
Sets the game layout on which ads should be placed.
Parameters:
adLayoutTarget layout
setAdPlacementListener
public final void setAdPlacementListener(
    AdPlacementListener listener
)
Sets the listener that is responsible for handling ad placement events.
Parameters:
listenerAd placement listener, or null to remove the current listener
setAdUnitId
public void setAdUnitId(
    String adUnitId
)
Sets the identifier for the ad unit that should be displayed over the stage by this ad manager. The format of the identifier depends on the specific implementation.
Parameters:
adUnitIdAd unit identifier
showAd
public final void showAd(
    AdManager.Placements show
)
Hides or displays the ad unit at a specified location.
Parameters:
showValue indicating ad placement options