Millennial Media Android Ad SDK Public Documentation  6.8.3
Classes | Public Member Functions | Static Public Member Functions | List of all members
InlineAd Class Reference

Inherits AdPlacement.


class  AdSize
interface  InlineAbortListener
class  InlineAdMetadata
class  InlineErrorStatus
interface  InlineListener

Public Member Functions

void request (InlineAdMetadata inlineAdMetadata)
void setDisplayOptions (DisplayOptions displayOptions)
void abort (InlineAbortListener inlineAbortListener)
void setListener (InlineListener listener)
void setRefreshInterval (int interval)
CreativeInfo getCreativeInfo ()
synchronized void destroy ()
boolean isDestroyed ()

Static Public Member Functions

static InlineAd createInstance (String placementId, ViewGroup adContainer) throws MMException
static void requestBid (String placementId, InlineAdMetadata metadata, BidRequestListener bidRequestListener) throws MMException

Detailed Description

InlineAd is the ad space in your application where rectangular and expandable advertisements (for example: banner, footer) are served. Each InlineAd must have a unique placementId and a valid adContainer.

Ad refreshing is not enabled by default. Call setRefreshInterval to enable it. Set the refresh interval to 0 to disable the ad refreshing.

Use InlineListener to receive ad event callbacks. For example, when an ad is successfully loaded from the server the InlineListener.onRequestSucceeded callback is invoked. The click stats are handled internally.

Member Function Documentation

§ abort()

void abort ( InlineAbortListener  inlineAbortListener)

Attempts to abort an active ad request. Depending on how far the ad request has gotten, the request may still succeed or fail before the abort takes effect.

If the abort is successful then the InlineAbortListener.onAborted callback will be invoked. If the request succeeds or fails then the InlineAbortListener.onAbortFailed callback will be invoked after the InlineListener.onRequestSucceeded or InlineListener.onRequestFailed callback is invoked. If no ad request is in progress at the time abort() is called, then the call is ignored.

§ createInstance()

static InlineAd createInstance ( String  placementId,
ViewGroup  adContainer 
) throws MMException

Constructs an InlineAd instance with a unique placementId and adContainer.

placementIdidentifier of the placement that is used by the server for selecting ad content
adContainercontainer that the ad content will be inserted into
instance of InlineAd or null if an error occurred
MMExceptionif the container is invalid or the SDK is not initialized

§ destroy()

synchronized void destroy ( )

Destroys the internal components of the ad. If the ad is in a loading state the destroy will happen after the loading completes.

After the ad has been destroyed it can no longer be used to make requests and all public API methods called will fail with a message outputted to the logs. Remove all references to this placement and create a new placement to make a new ad request.

§ getCreativeInfo()

CreativeInfo getCreativeInfo ( )

Retrieves a CreativeInfo object, containing the creativeId and demandSource.

the CreativeInfo object.

§ isDestroyed()

boolean isDestroyed ( )

Determines if the ad placement has been destroyed.

true if destroyed, false otherwise

§ request()

void request ( InlineAdMetadata  inlineAdMetadata)

Requests and displays ad content for the current InlineAd instance

inlineAdMetadatathe metadata to be included in the request for this InlineAd instance

§ requestBid()

static void requestBid ( String  placementId,
InlineAdMetadata  metadata,
BidRequestListener  bidRequestListener 
) throws MMException

Requests a bid and returns it to the BidRequestListener

placementIdidentifier of the placement that is used by the server for selecting ad content
metadatathe metadata to be included in the request for this InlineAd bid
bidRequestListeneran instance of BidRequestListener that will be called in response to the bid request

§ setDisplayOptions()

void setDisplayOptions ( DisplayOptions  displayOptions)

Set the display options for the InlineAd instance. These display options will take effect on the next request. Setting display options is optional.

displayOptionsan instance of AdPlacement.DisplayOptions

§ setListener()

void setListener ( InlineListener  listener)

Sets the InlineListener to receive ad event callbacks.

listenerthe InlineListener to set. Callbacks will be invoked when ad events occur.

§ setRefreshInterval()

void setRefreshInterval ( int  interval)

Sets the refresh interval in milliseconds. If the value is less than the allowed minimum and greater than 0 then the minimum value will be used.

Set to 0 to disable refreshing.

intervalthe refresh interval (in milliseconds) to set