Class InterstitialAd

com.yandex.mobile.ads

java.lang.Object ⇽ InterstitialAd

public class InterstitialAd

A class for interstitial advertising.

Constructors

InterstitialAd(@NonNull final Context context)

Creates an object of the InterstitialAd class programmatically.

Methods

void destroy()

Destroys an object of the InterstitialAd class and releases all resources in use.

String getBlockId()

Returns the unique ID of the ad placement.

InterstitialEventListener getInterstitialEventListener()

Returns an object of the InterstitialEventListener class.

boolean isLoaded()

Returns the result of ad loading.

void loadAd(final AdRequest adRequest)

Loads ads in the background mode.

void setBlockId(final String blockId)

Sets the unique ID of the ad space.

void setInterstitialEventListener(final InterstitialEventListener interstitialListener)

Specifies an object of the InterstitialEventListener class for getting notifications about events that occur during the lifecycle of an interstitial ad.

void shouldOpenLinksInApp(final boolean shouldOpenLinksInApp)

Sets the method for opening links from the application.

void show()

Displays the ad if it was loaded.

Constructor Detail

InterstitialAd

public InterstitialAd (@NonNull final Context context)

Creates an object of the InterstitialAd class programmatically.

Parameters:
context

An object of the Context system class.

Method Detail

destroy

public void destroy ()

Destroys an object of the InterstitialAd class and releases all resources in use.

Note.

Don't use an object of the InterstitialAd class after calling this method.

getBlockId

public String getBlockId ()

Returns the unique ID of the ad placement.

Returns:

Unique ID of the ad placement.

getInterstitialEventListener

public InterstitialEventListener getInterstitialEventListener ()

Returns an object of the InterstitialEventListener class.

Returns:

An object of the InterstitialEventListener class, which will receive notifications about events that occur during the lifecycle of an interstitial ad.

isLoaded

public boolean isLoaded ()

Returns the result of ad loading.

Returns:

If true, the ad has been successfully loaded and is ready to be displayed. If ad loading failed or the ad isn't ready to be displayed, the false value is returned.

loadAd

public void loadAd (final AdRequest adRequest)

Loads ads in the background mode.

Note.

The ID of the advertising block blockId must be passed before calling this method.

Parameters:
adRequest

An object of the AdRequest class with data for a targeted ad request.

setBlockId

public void setBlockId (final String blockId)

Sets the unique ID of the ad space.

Parameters:
blockId

Unique ID of the ad placement.

Throws:

throwIllegalArgumentIfEmpty

An empty blockId or the null value is set for the current object of the InterstitialAd class.

throwIllegalArgumentIfNotEmpty

The blockId is already set for the current object of the InterstitialAd class.

setInterstitialEventListener

public void setInterstitialEventListener (final InterstitialEventListener interstitialListener)

Specifies an object of the InterstitialEventListener class for getting notifications about events that occur during the lifecycle of an interstitial ad.

Parameters:
interstitialListener

An object of the InterstitialEventListener class, which will receive notifications about events that occur during the lifecycle of an interstitial ad.

shouldOpenLinksInApp

public void shouldOpenLinksInApp (final boolean shouldOpenLinksInApp)

Sets the method for opening links from the application.

Parameters:
shouldOpenLinksInApp
How to open links from the app. Acceptable values:
  • true — Open links in the app browser.

  • false — Open links in the device browser.

The default value is false.

show

public void show ()

Displays the ad if it was loaded.