InterstitialAdPreloader.Companion

object InterstitialAdPreloader.Companion : AdPreloader


Summary

Public functions

open Boolean
destroy(preloadId: String)

Permanently stops preloading for the given preloadId and destroys all associated preloaded ads.

open PreloadConfiguration?

Returns the PreloadConfiguration associated with this preloadId and ad format, or null if one does not exist.

open Map<StringPreloadConfiguration>

Returns a map of all PreloadConfigurations associated with this format, keyed by preload ID.

open Int

Returns the number of preloaded ads available for the given preloadId.

open Boolean
isAdAvailable(preloadId: String)

Returns true if at least one ad is available for the given preloadId.

open Int
numAdsAvailable(preloadId: String)

This function is deprecated. Use {@link #getNumAdsAvailable} instead

open InterstitialAd?
pollAd(preloadId: String)

Returns an ad preloaded from start or null if no ad is available.

open Boolean
start(preloadId: String, preloadConfiguration: PreloadConfiguration)

Starts preloading without a callback.

open Boolean
start(
    preloadId: String,
    preloadConfiguration: PreloadConfiguration,
    preloadCallback: PreloadCallback?
)

Starts preloading ads for the given PreloadConfiguration + preloadId and returns true.

Public functions

destroy

open fun destroy(preloadId: String): Boolean

Permanently stops preloading for the given preloadId and destroys all associated preloaded ads.

Returns true if preloading was stopped, false if there is no active preload for preloadId.

getConfiguration

open fun getConfiguration(preloadId: String): PreloadConfiguration?

Returns the PreloadConfiguration associated with this preloadId and ad format, or null if one does not exist.

getConfigurations

open fun getConfigurations(): Map<StringPreloadConfiguration>

Returns a map of all PreloadConfigurations associated with this format, keyed by preload ID.

getNumAdsAvailable

open fun getNumAdsAvailable(preloadId: String): Int

Returns the number of preloaded ads available for the given preloadId.

isAdAvailable

open fun isAdAvailable(preloadId: String): Boolean

Returns true if at least one ad is available for the given preloadId.

numAdsAvailable

open fun numAdsAvailable(preloadId: String): Int

Returns the number of preloaded ads available for the given preloadId.

pollAd

open fun pollAd(preloadId: String): InterstitialAd?

Returns an ad preloaded from start or null if no ad is available.

Note that this may be any of the ads preloaded for preloadId. The order returned is not guaranteed to match the order of PreloadCallback.onAdPreloaded events.

start

open fun start(preloadId: String, preloadConfiguration: PreloadConfiguration): Boolean

Starts preloading without a callback.

start

open fun start(
    preloadId: String,
    preloadConfiguration: PreloadConfiguration,
    preloadCallback: PreloadCallback?
): Boolean

Starts preloading ads for the given PreloadConfiguration + preloadId and returns true.

The SDK will continue to preload ads until the number the number of ads specified by PreloadConfiguration.bufferSize is reached, attempting to keep the buffer full throughout the session.

Each ad request the SDK attempts results in either a PreloadCallback.onAdPreloaded or PreloadCallback.onAdFailedToPreload callback. The SDK includes retry logic for requests that fail.

If a PreloadConfiguration was already started with preloadId, this method becomes a no-op and returns false.

Parameters
preloadId: String

A string identifier for this PreloadConfiguration + ad format. Use this identifier for all future calls to control preloading for this PreloadConfiguration, like pollAd or destroy.

preloadConfiguration: PreloadConfiguration

The configuration to preload ads for.

preloadCallback: PreloadCallback?

A callback to be invoked when ad availability changes for the given PreloadConfiguration.

Returns
Boolean

True if preloading started, false otherwise.