GoogleMobileAds.Api.RewardedAdPreloader

The preloader for rewarded ads.

Summary

Public static functions

DequeueAd(string preloadId)
Returns a preloaded ad and removes it from the cache.
Destroy(string preloadId)
void
Stops preloading for the given preloadId and destroys all associated preloaded ads.
DestroyAll()
void
Stops preloading and destroys preloaded ads for all preload configurations.
GetConfiguration(string preloadId)
Get the rewarded ad PreloadConfiguration associated with the given preload ID, or null if one does not exist.
GetConfigurations()
Dictionary< string, PreloadConfiguration >
Get a dictionary of all rewarded ad PreloadConfigurations, keyed by their associated preload ID, or an empty dictionary if no preloaders exist.
GetNumAdsAvailable(string preloadId)
int
Get the number of ads available for the given preload ID.
IsAdAvailable(string preloadId)
bool
Determines whether at least one ad is available for the given preloadId.
Preload(string preloadId, PreloadConfiguration preloadConfiguration, Action< string, ResponseInfo > onAdPreloaded, Action< string, AdError > onAdFailedToPreload, Action< string > onAdsExhausted)
bool
Starts preloading rewarded ads from the configuration for the given preload ID.

Public static functions

DequeueAd

RewardedAd DequeueAd(
  string preloadId
)

Returns a preloaded ad and removes it from the cache.

Details
Parameters
preloadId
The ad's preload ID.
Returns
The preloaded ad for the given preload ID, or null if no ad is available.

The ad returned may be any of the ads preloaded for preloadId. The order returned is not guaranteed to match the order of OnAdAvailable events.

Destroy

void Destroy(
  string preloadId
)

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

Details
Parameters
preloadId
The preload ID to stop preloading for.

DestroyAll

void DestroyAll()

Stops preloading and destroys preloaded ads for all preload configurations.

GetConfiguration

PreloadConfiguration GetConfiguration(
  string preloadId
)

Get the rewarded ad PreloadConfiguration associated with the given preload ID, or null if one does not exist.

GetConfigurations

Dictionary< string, PreloadConfiguration > GetConfigurations()

Get a dictionary of all rewarded ad PreloadConfigurations, keyed by their associated preload ID, or an empty dictionary if no preloaders exist.

GetNumAdsAvailable

int GetNumAdsAvailable(
  string preloadId
)

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

Details
Parameters
preloadId
The preload ID to check for available ads.
Returns
The number of ads available for the given preload ID.

IsAdAvailable

bool IsAdAvailable(
  string preloadId
)

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

Details
Parameters
preloadId
The preload ID to check for availability.
Returns
True if there is an ad available for the given preload ID.

Preload

bool Preload(
  string preloadId,
  PreloadConfiguration preloadConfiguration,
  Action< string, ResponseInfo > onAdPreloaded,
  Action< string, AdError > onAdFailedToPreload,
  Action< string > onAdsExhausted
)

Starts preloading rewarded ads from the configuration for the given preload ID.

Details
Parameters
preloadId
A string that uniquely identifies the PreloadConfiguration. Use this identifier when calling DequeueAd to retrieve a preloaded ad for this configuration.
preloadConfiguration
The configuration that dictates how ads are preloaded.
onAdPreloaded
Called when a new ad is available for the given preload ID.
onAdFailedToPreload
Called when an ad failed to load for a given preload ID.
onAdsExhausted
Called when the last available ad is exhausted for the given preload ID.
Returns
False if preloading fails to start.