Android Verizon Ads SDK Standard Edition Documentation  1.1
Classes | Public Member Functions | Static Public Member Functions | List of all members
InterstitialAdFactory Class Reference

InterstitialAdFactory is a factory class that handles loading and caching of InterstitialAd placements. More...

Classes

interface  InterstitialAdFactoryListener
 Interface for receiving notifications from the InterstitialAdFactory. More...
 
enum  TrimStrategy
 Defines the strategies that can be used to trim the cache. More...
 

Public Member Functions

 InterstitialAdFactory (final Context context, final String placementId, final InterstitialAdFactoryListener adFactoryListener)
 Factory method for creating InterstitialAd objects. More...
 
void abortCacheLoad ()
 Aborts InterstitialAdFactory#cacheAds requests that are still active.
 
void abortLoad ()
 Aborts any load requests that are still active.
 
void cacheAds (final int maxAds)
 Sets the size of the cache and fills the cache with ads to the specified size. More...
 
int getCacheSize ()
 Returns the number of InterstitialAd items loaded in the cache. More...
 
String getPlacementId ()
 Get the placementId for the InterstitialAdFactory. More...
 
RequestMetadata getRequestMetadata ()
 Provides access to the RequestMetadata that has been set for the InterstitialAdFactory. More...
 
void load (final InterstitialAdListener interstitialAdListener)
 Requests a new InterstitialAd. More...
 
void load (final Bid bid, final InterstitialAdListener interstitialAdListener)
 Loads the InterstitialAd for the provided bid. More...
 
void loadFromCache (final Context context, final InterstitialAdListener interstitialAdListener)
 Loads an ad from the cache. More...
 
void setListener (final InterstitialAdFactoryListener adFactoryListener)
 Set the InterstitialAdFactoryListener to receive ad factory event callbacks. More...
 
void setRequestMetaData (final RequestMetadata requestMetadata)
 Sets a RequestMetadata object that overrides global RequestMetadata for the InterstitialAdFactory’s ad requests. More...
 
void trimCache (final TrimStrategy trimStrategy, final int maxSize)
 Trims the size of the current cache to a specified number of ads. More...
 

Static Public Member Functions

static void requestBid (final Context context, final String placementId, final RequestMetadata requestMetadata, final BidRequestListener bidRequestListener)
 Requests a bid for the opportunity to win the InterstitialAd impression. More...
 

Detailed Description

InterstitialAdFactory is a factory class that handles loading and caching of InterstitialAd placements.

It uses the InterstitialAdFactoryListener interface to provide notifications about InterstitialAd creation.

Constructor & Destructor Documentation

◆ InterstitialAdFactory()

InterstitialAdFactory ( final Context  context,
final String  placementId,
final InterstitialAdFactoryListener  adFactoryListener 
)

Factory method for creating InterstitialAd objects.

Use this to set the placementId and listener for InterstitialAds that the InterstitialAdFactory will create.

Parameters
contextthe context in which the InterstitialAds will be displayed
placementIdplacementId that will be set for all InterstitialAds that the InterstitialAdFactory creates
adFactoryListenerthe InterstitialAdFactoryListener that will receive ad factory events for the InterstitialAdFactory

Member Function Documentation

◆ cacheAds()

void cacheAds ( final int  maxAds)

Sets the size of the cache and fills the cache with ads to the specified size.

Parameters
maxAdsthe number of InterstitialAds to load into the cache

◆ getCacheSize()

int getCacheSize ( )

Returns the number of InterstitialAd items loaded in the cache.

Returns
The number of InterstitialAds in the cache

◆ getPlacementId()

String getPlacementId ( )

Get the placementId for the InterstitialAdFactory.

Returns
the placementId for the InterstitialAdFactory

◆ getRequestMetadata()

RequestMetadata getRequestMetadata ( )

Provides access to the RequestMetadata that has been set for the InterstitialAdFactory.

Returns
the RequestMetadata set for the InterstitialAdFactory

◆ load() [1/2]

void load ( final InterstitialAdListener  interstitialAdListener)

Requests a new InterstitialAd.

Calling this method does not affect the cache.

Parameters
interstitialAdListenerthe InterstitialAd.InterstitialAdListener that will receive ad events for the InterstitialAd

◆ load() [2/2]

void load ( final Bid  bid,
final InterstitialAdListener  interstitialAdListener 
)

Loads the InterstitialAd for the provided bid.

Parameters
bidthe Bid that will be loaded
interstitialAdListenerthe InterstitialAd.InterstitialAdListener that will receive ad events for the InterstitialAd

◆ loadFromCache()

void loadFromCache ( final Context  context,
final InterstitialAdListener  interstitialAdListener 
)

Loads an ad from the cache.

Calling this method when there are no ads in the cache will invoke the InterstitialAdFactoryListener#onError callback.

Parameters
contextthe context in which the InterstitialAds will be loaded
interstitialAdListenerthe InterstitialAd.InterstitialAdListener that will receive ad events for the InterstitialAd

◆ requestBid()

static void requestBid ( final Context  context,
final String  placementId,
final RequestMetadata  requestMetadata,
final BidRequestListener  bidRequestListener 
)
static

Requests a bid for the opportunity to win the InterstitialAd impression.

Parameters
contextthe context in which the InterstitialAds will be loaded
placementIdplacementId that will be set for all InterstitialAds that the InterstitialAdFactory creates
requestMetadatathe RequestMetadata to use for ad requests
bidRequestListenerthe BidRequestListener that will receive bid request events

◆ setListener()

void setListener ( final InterstitialAdFactoryListener  adFactoryListener)

Set the InterstitialAdFactoryListener to receive ad factory event callbacks.

Parameters
adFactoryListenerthe InterstitialAdFactoryListener to set. Called when ad factory events occur.

◆ setRequestMetaData()

void setRequestMetaData ( final RequestMetadata  requestMetadata)

Sets a RequestMetadata object that overrides global RequestMetadata for the InterstitialAdFactory’s ad requests.

Parameters
requestMetadatathe RequestMetadata to use for ad requests

◆ trimCache()

void trimCache ( final TrimStrategy  trimStrategy,
final int  maxSize 
)

Trims the size of the current cache to a specified number of ads.

Parameters
trimStrategydescribes how you want to trim the cache. Valid trim strategies include TrimStrategy#TRIM_OLDEST and TrimStrategy#TRIM_NEWEST.
maxSizethe maximum number of entries in the cache. Specify 0 to clear the cache. If maxSize is greater than or equal to the current cache size, no entries are removed.