Banners /

API for Banners.

Public Methods

public static void /RequestBanner(string adUnitId, AdPosition position, MaxAdSize maxAdSize) /+5.8.0

  • Description: Requests a banner ad and immediately shows the ad once it is loaded.

  • Parameters:

    • adUnitId: A String with the ad unit ID.
    • position: Where in the screen to position the loaded ad. Refer to MoPub.AdPosition.
    • maxAdSize: The maximum size of the banner to load. Refer to MoPub.MaxAdSize. The default value of this parameter is MaxAdSize.Width320Height50.

public static void /CreateBanner(string adUnitId, AdPosition position, BannerType bannerType) /+5.0.0-5.12.0

  • Description: (Deprecated) Requests a banner ad and immediately shows it once loaded. CreateBanner is deprecated please use RequestBanner instead.

  • Parameters:

    • adUnitId: A String with the ad unit ID.
    • position: Where in the screen to position the loaded ad. See MoPub.AdPosition.
    • bannerType: The size of the banner to load

public static void /ShowBanner(string adUnitId, bool shouldShow) /+5.0.0

  • Description: Shows or hides an already-loaded banner ad. Banners are automatically shown after first loading.

  • Parameters:

    • adUnitId: A String with the ad unit ID.
    • shouldShow: A bool with true to show the ad, or false to hide it.

public static void /RefreshBanner(string adUnitId, string keywords, string userDataKeywords) /+5.0.0

  • Description: Sets the desired keywords and reloads the banner ad. If a user is in a GDPR region and MoPub doesn’t obtain consent from the user, keywords will be sent to the server, but userDataKeywords will be excluded.

  • Parameters:

    • adUnitId: A String with the ad unit ID.
    • keywords: A comma-separated string with the desired keywords for this ad.
    • userDataKeywords: An optional comma-separated string with user data for this ad. Default value is an empty String.

public static void /SetAutorefresh(string adUnitId, bool enabled) /+5.0.0

  • Description: Enables or disables the automatic refresh of banners every 30 seconds.

  • Parameters:

    • adUnitId: A String with the ad unit ID.
    • enabled: true if the banner ad should automatically refresh every 30 seconds; false otherwise.

public static void /ForceRefresh(string adUnitId) /+5.0.0

  • Description: Refreshes the banner ad regardless of whether auto-refresh is enabled.

  • Parameters:

    • adUnitId: A String with the ad unit ID.

public static void /DestroyBanner(string adUnitId) /+5.0.0

  • Description: Destroys the banner ad and removes it from the view.

  • Parameters:

    • adUnitId: A String with the ad unit ID.

Last updated July 22, 2020

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2020 MoPub (a division of Twitter, Inc.)