Skip to content

XMediator::Api::RewardedAds

This class is the entry point for displaying rewarded ads. More...

Public Events

Name
Action< string, LoadResult > OnLoaded()
Notifies when a rewarded ad was loaded successfully, containing a LoadResult object.
Action< string, ImpressionData > OnImpression()
Notifies when a rewarded ad impression was recorded, containing an ImpressionData object.
Action< string, ShowError > OnFailedToShow()
Notifies when a rewarded ad failed to show, containing a ShowError object describing the error.
Action< string > OnShowed()
Notifies when a rewarded ad was shown.
Action< string > OnClicked()
Notifies when a rewarded ad was clicked.
Action< string > OnDismissed()
Notifies when a rewarded ad was dismissed.
Action< string > OnEarnedReward()
Notifies when the user should be granted a reward for watching an ad. This callback won't be called if the user skipped the ad.

Public Functions

Name
void Load(string placementId)
Starts loading a new rewarded ad.
bool IsReady(string placementId)
Indicates if a rewarded ad for the placement id is ready to be shown.
bool IsReady()
Indicates if there is a rewarded ad ready to be shown for any placement id.
void Show()
Shows a previously loaded rewarded ad for any placementId.
void Show(string placementId)
Shows a previously loaded rewarded ad for the specified placementId.
void ShowFromAdSpace(string adSpace)
Shows a previously loaded rewarded ad for any placementId.
void ShowFromAdSpace(string placementId, string adSpace)
Shows a previously loaded rewarded ad for the specified placementId.

Detailed Description

class XMediator::Api::RewardedAds;

This class is the entry point for displaying rewarded ads.

To start, load a rewarded ad by providing a valid placement id in the Load method.

Note: Only one call to rewarded load per placement id is needed. Subsequent calls with the same placement id will be ignored.

Public Events Documentation

event OnLoaded

Action< string, LoadResult > OnLoaded()

Notifies when a rewarded ad was loaded successfully, containing a LoadResult object.

event OnImpression

Action< string, ImpressionData > OnImpression()

Notifies when a rewarded ad impression was recorded, containing an ImpressionData object.

event OnFailedToShow

Action< string, ShowError > OnFailedToShow()

Notifies when a rewarded ad failed to show, containing a ShowError object describing the error.

event OnShowed

Action< string > OnShowed()

Notifies when a rewarded ad was shown.

event OnClicked

Action< string > OnClicked()

Notifies when a rewarded ad was clicked.

event OnDismissed

Action< string > OnDismissed()

Notifies when a rewarded ad was dismissed.

event OnEarnedReward

Action< string > OnEarnedReward()

Notifies when the user should be granted a reward for watching an ad. This callback won't be called if the user skipped the ad.

Public Functions Documentation

function Load

void Load(
    string placementId
)

Starts loading a new rewarded ad.

Parameters:

  • placementId The placement id of the ad to be loaded.

After the first call, no more calls to this method are needed, as the ad will reload automatically.

function IsReady

bool IsReady(
    string placementId
)

Indicates if a rewarded ad for the placement id is ready to be shown.

Parameters:

  • placementId The placement id of the ad.

Return: true if an ad is ready to be shown.

function IsReady

bool IsReady()

Indicates if there is a rewarded ad ready to be shown for any placement id.

Return: true if an ad is ready to be shown.

function Show

void Show()

Shows a previously loaded rewarded ad for any placementId.

If multiple ads with different placement ids were previously loaded, the sdk will try to present the best one available.

function Show

void Show(
    string placementId
)

Shows a previously loaded rewarded ad for the specified placementId.

Parameters:

  • placementId The placementId of the ad.

function ShowFromAdSpace

void ShowFromAdSpace(
    string adSpace
)

Shows a previously loaded rewarded ad for any placementId.

Parameters:

  • adSpace The space in your app from where the ad will be shown (eg: dashboard, settings). Used for tracking.

If multiple ads with different placement ids were previously loaded, the sdk will try to present the best one available.

function ShowFromAdSpace

void ShowFromAdSpace(
    string placementId,
    string adSpace
)

Shows a previously loaded rewarded ad for the specified placementId.

Parameters:

  • placementId The placementId of the ad.
  • adSpace The space in your app from where the ad will be shown (eg: dashboard, settings). Used for tracking.

Updated on 2024-11-07 at 18:31:49 +0000