Banner class

Warning.

This is an archived version of the documentation. Actual documentation for all platforms can be found here.

A class for displaying banner ads.

Method description

Banner(string blockId, AdSize adSize, AdPosition position)

public Banner(string blockId, AdSize adSize, AdPosition position)

Creates an object of the Banner class with the specified parameters.

Parameters:
blockId A unique identifier of the advertising space that is set in the Partner interface in the format demo-banner-yandex.
adSize Banner ad sizes from the AdSize class.
position The banner's position on the screen.
blockId A unique identifier of the advertising space that is set in the Partner interface in the format demo-banner-yandex.
adSize Banner ad sizes from the AdSize class.
position The banner's position on the screen.

Returns:

An object of the Banner class with the specified parameters.

void LoadAd(AdRequest request)

public void LoadAd(AdRequest request)

Starts ad loading in the background.

Parameters:
request An object of the AdRequest class including the data for a targeted ad request.
request An object of the AdRequest class including the data for a targeted ad request.

void Hide()

public void Hide()

Hides the object of the Banner class from the screen.

void Show()

public void Show()

Shows the object of the Banner class on the screen.

void Destroy()

public void Destroy()

Destroys an object of the Banner class and clears all the resources occupied by it.

Event description

event EventHandler<EventArgs> OnAdLoaded

public event EventHandler<EventArgs> OnAdLoaded

Called when the ad is loaded.

event EventHandler<AdFailureEventArgs> OnAdFailedToLoad

public event EventHandler<AdFailureEventArgs> OnAdFailedToLoad

Called if ad loading fails.

event EventHandler<EventArgs> OnReturnedToApplication

public event EventHandler<EventArgs> OnReturnedToApplication

Called when the user returns to the app after the click.

event EventHandler<EventArgs> OnLeftApplication

public event EventHandler<EventArgs> OnLeftApplication

Called when the app becomes inactive because the user has clicked on an ad and is about to switch to a different app (for example, a browser).

event EventHandler<EventArgs> OnAdClicked

public event event EventHandler<EventArgs> OnAdClicked

It's called when the user clicks on your ad.

event EventHandler<ImpressionData> OnImpression

public event event EventHandler<ImpressionData> OnImpression

It's called when an ad impression has been counted.