RewardedAdPreloader

class RewardedAdPreloader


The preloader for rewarded ads.

Summary

Public functions

java-static Boolean
destroy(preloadId: String!)

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

java-static Unit

Stops preloading and destroys preloaded ads for all preload configurations.

java-static PreloadConfiguration?
getConfiguration(preloadId: String!)

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

java-static (Mutable)Map<String!, PreloadConfiguration!>!

Returns a map of all rewarded ad PreloadConfigurations, keyed by their associated preload ID.

java-static Int

Returns the number of available ads for the given preload ID.

java-static Boolean
isAdAvailable(preloadId: String!)

Determines whether least one ad is available for the given preloadId.

java-static RewardedAd?
pollAd(preloadId: String!)

Returns an ad preloaded from start or start and removes it from the cache.

java-static Boolean
start(preloadId: String!, preloadConfiguration: PreloadConfiguration!)

Starts preloading ads for the given preloadId and PreloadConfiguration.

java-static Boolean
start(
    preloadId: String!,
    preloadConfiguration: PreloadConfiguration!,
    preloadCallback: PreloadCallbackV2!
)

Starts preloading ads for the given preloadId, PreloadConfiguration, and .

Public functions

destroy

java-static fun destroy(preloadId: String!): Boolean

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

Parameters
preloadId: String!

The preload ID of the configuration to destroy.

Returns
Boolean

true if an active preload configuration was destroyed. Returns false if there is no active preload configuration for the given preloadId.

destroyAll

java-static fun destroyAll(): Unit

Stops preloading and destroys preloaded ads for all preload configurations.

getConfiguration

java-static fun getConfiguration(preloadId: String!): PreloadConfiguration?

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

Parameters
preloadId: String!

The preload ID linked to this configuration.

Returns
PreloadConfiguration?

The PreloadConfiguration for the given preload ID, or null if there is no configuration for the given preload ID.

getConfigurations

java-static fun getConfigurations(): (Mutable)Map<String!, PreloadConfiguration!>!

Returns a map of all rewarded ad PreloadConfigurations, keyed by their associated preload ID.

Returns
(Mutable)Map<String!, PreloadConfiguration!>!

The rewarded ad configurations, or an empty map if no preloaders exist.

getNumAdsAvailable

java-static fun getNumAdsAvailable(preloadId: String!): Int

Returns the number of available ads for the given preload ID.

Parameters
preloadId: String!

The preload ID to check for availability.

Returns
Int

The number of available ads for the given preload ID.

isAdAvailable

java-static fun isAdAvailable(preloadId: String!): Boolean

Determines whether least one ad is available for the given preloadId.

Parameters
preloadId: String!

The preload ID to check for availability.

Returns
Boolean

true if there is an available ad for the given preload ID, false otherwise.

pollAd

java-static fun pollAd(preloadId: String!): RewardedAd?

Returns an ad preloaded from start or start and removes it from the cache.

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

Parameters
preloadId: String!

The ad's preload ID.

Returns
RewardedAd?

An rewarded ad for the given preload ID, or null if no ad is available.

start

java-static fun start(preloadId: String!, preloadConfiguration: PreloadConfiguration!): Boolean

Starts preloading ads for the given preloadId and PreloadConfiguration.

The SDK continues preloading ads until the number of ads specified by getBufferSize is reached, attempting to keep the buffer full throughout the session.

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. Use this identifier when calling pollAd to get an ad for this configuration.

preloadConfiguration: PreloadConfiguration!

The configuration for preloading ads.

Returns
Boolean

true if preloading started, false if the preloadId is in-use.

start

java-static fun start(
    preloadId: String!,
    preloadConfiguration: PreloadConfiguration!,
    preloadCallback: PreloadCallbackV2!
): Boolean

Starts preloading ads for the given preloadId, PreloadConfiguration, and .

The SDK continues preloading ads until the number of ads specified by getBufferSize is reached, attempting to keep the buffer full throughout the session.

For each ad request, the SDK triggers either an onAdPreloaded callback upon successful preloading or an onAdFailedToPreload callback if preloading fails. The SDK automatically retries failed requests.

If a PreloadConfiguration has already started with the given preloadId, this method does nothing and returns false. becomes a no-op and returns false.

Parameters
preloadId: String!

A string that uniquely identifies this PreloadConfiguration. Use this identifier when calling pollAd to retrieve a preloaded ad for this configuration.

preloadConfiguration: PreloadConfiguration!

The configuration that dictates how ads are preloaded.

preloadCallback: PreloadCallbackV2!

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

Returns
Boolean

true if preloading started, false if the preloadId is in-use.