Anchored adaptive banner ads

  • Adaptive banners maximize ad performance by optimizing the ad size for each device, using fixed aspect ratios for the best ad size.

  • They are a drop-in replacement for standard 320x50 banners and smart banners, designed for anchored positions (top or bottom of the screen).

  • Adaptive banners offer advantages over smart banners: using any provided width (accounting for safe areas), selecting optimal height per device (reducing fragmentation).

  • When implementing, consider the view's width (including safe areas), use an opaque background, and use the latest SDK and adapter versions.

  • To get an adaptive banner size, use the provided static methods, such as AdSize.GetCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(width), after calculating the device or desired width.

Adaptive banners provide a flexible way to display ads, with a user-specified width and a Google-optimized height. The minimum banner height is 50 density-independent pixels, while the maximum is capped at 15% of the device's height or 90 density-independent pixels, whichever is smaller.

These banners perform best when they use the full available width, but you should always consider safe areas and display cutouts that might obstruct visibility when setting the banner's width.

Prerequisites

Always test with test ads

The following sample code contains an ad unit ID which you can use to request test ads. It's been specially configured to return test ads rather than production ads for every request, making it safe to use.

However, after you've registered an app in the Ad Manager web interface and created your own ad unit IDs for use in your app, explicitly configure your device as a test device during development.

/21775744923/example/adaptive-banner

Create an anchored adaptive banner

The following example creates an anchored adaptive banner view positioned to the bottom of the screen:

// Get the device safe width in density-independent pixels.
int deviceWidth = MobileAds.Utils.GetDeviceSafeWidth();

// Define the anchored adaptive ad size.
AdSize adaptiveSize =
    AdSize.GetCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(deviceWidth);

// Create an anchored adaptive banner view.
adManagerBannerView = new AdManagerBannerView("AD_UNIT_ID", adaptiveSize, AdPosition.Bottom);

Replace AD_UNIT_ID with your ad unit ID.

With the anchored adaptive banner view created, you can now load the banner as described in Get Started guide.