public class BannerCache extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
BannerCache.CacheDelegate
Optional delegate informing about events in BannerCache.
|
| Constructor and Description |
|---|
BannerCache(BannerCacheConfiguration cacheConfiguration)
Creates a cache of automatically preloaded banner ads.
|
BannerCache(String placementName,
BannerCache.CacheDelegate delegate,
int size,
boolean shouldCacheAdditionalAdAtStart,
BannerRequest requestConfiguration)
Deprecated.
This method is deprecated and will be removed in the future. Use
BannerCache(BannerCacheConfiguration) instead. |
| Modifier and Type | Method and Description |
|---|---|
BannerPlacementLayout |
consume()
Returns an instance of
BannerPlacementLayout to be used within the app. |
BannerPlacementLayout |
consume(boolean force)
Returns an instance of
BannerPlacementLayout to be used within the app. |
void |
destroy()
Destroys the BannerCache, clearing all preloaded banner ads and canceling pending reload requests.
|
void |
setCacheDelegate(BannerCache.CacheDelegate delegate)
Deprecated.
This method is deprecated and will be removed in the future. Use
BannerCacheConfiguration#setDelegate(CacheDelegate) instead. |
String |
toString() |
void |
updateRequestConfiguration(BannerRequest requestConfiguration,
boolean shouldRefresh)
Updates the configuration that will be used when requesting new banners.
|
public BannerCache(BannerCacheConfiguration cacheConfiguration)
cacheConfiguration - BannerCacheConfiguration instance used to configure the cache.@Deprecated public BannerCache(String placementName, BannerCache.CacheDelegate delegate, int size, boolean shouldCacheAdditionalAdAtStart, BannerRequest requestConfiguration)
BannerCache(BannerCacheConfiguration) instead.placementName - The name of the banner placement that will be created. The placement will be created by the cache and should not be created manually.delegate - Optional cache delegate. Can be null.size - Defines how many preloaded banners should be available in the cache. Should be smaller than 5.shouldCacheAdditionalAdAtStart - Defines if the cache should load additional ad at the beginning.requestConfiguration - The configuration that will be used when requesting new banners. Can not be null.public void updateRequestConfiguration(BannerRequest requestConfiguration, boolean shouldRefresh)
requestConfiguration - BannerRequest instance. Can not be null.shouldRefresh - True if the whole cache should be re-loaded with new banner request configuration, false if new configuration should only be used for new requests.@Deprecated public void setCacheDelegate(BannerCache.CacheDelegate delegate)
BannerCacheConfiguration#setDelegate(CacheDelegate) instead.delegate - BannerCache.CacheDelegate instance.public BannerPlacementLayout consume()
BannerPlacementLayout to be used within the app. Also automatically counts an ad space.
BannerCache will no longer hold any references to returned banners, and they need to be destroyed manually by the app.
This method respects the frequency capping, set by BannerCacheConfiguration.setMinimumDelay(int)
BannerPlacementLayout instance.public BannerPlacementLayout consume(boolean force)
BannerPlacementLayout to be used within the app. Also automatically counts an ad space.
BannerCache will no longer hold any references to returned banners, and they need to be destroyed manually by the app.force - true if cache should try to return banner ignoring the frequency capping set by BannerCacheConfiguration.setMinimumDelay(int)BannerPlacementLayout instance.public void destroy()