Home


Banner Ads

Banner is a rectangle filled with an advertising content, displayed on the screen without interrupting the flow of your app.

// Toggle the banner ad

if (isBannerVisible) {
    Enhance.hideBannerAd();
    isBannerVisible = false;
}

else if (Enhance.isBannerAdReady()) {
    // The ad is ready, show it
    Enhance.showBannerAdWithPosition(Enhance.POSITION_TOP);
    isBannerVisible = true;
}

Methods

Enhance.isBannerAdReady

Boolean Enhance.isBannerAdReady(
    optional String placement = "default"
)

Check if an ad from any of the included SDK providers is ready to be shown.

Parameters:

optional String  placement - Specifies the internal placement of the ad (from the Enhance mediation editor).

Return Value:

Returns true if any ad is ready, false otherwise. When app is not Enhanced, always returns true.

Enhance.showBannerAdWithPosition

void Enhance.showBannerAdWithPosition(
    optional String position = Enhance.POSITION_BOTTOM,
    optional String placement = "default"
)

Display an ad if any is currently available. The ad provider is selected based on your app's mediation settings.

Parameters:

optional String  position - Specifies the position of this ad on the screen. Use either "top" or "bottom".

optional String  placement - Specifies the internal placement of the ad (from the Enhance mediation editor).

Enhance.hideBannerAd

void Enhance.hideBannerAd()

Hide the banner ad which is currently visible, if any.

Properties

String Enhance.PLACEMENT_DEFAULT

The default internal placement of all ad types. Always equal to "default".


String Enhance.POSITION_TOP

Indicates that the banner will be shown on the top of the screen.


String Enhance.POSITION_BOTTOM

Indicates that the banner will be shown on the bottom of the screen.