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

Before you continue, do the following:

- [Set up Google Mobile Ads Unity Plugin](https://developers.google.com/admob/unity/quick-start.md.txt).
- [Set up banner ads](https://developers.google.com/admob/unity/banner.md.txt).

## 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
AdMob web interface and created your own ad unit
IDs for use in your app, explicitly [configure your device as a test
device](https://developers.google.com/admob/unity/test-ads#enable_test_devices) during
development.

### Android

`ca-app-pub-3940256099942544/1033173712`

### iOS

`ca-app-pub-3940256099942544/4411468910`

## Create an anchored adaptive banner

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

```c#
// 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.
bannerView = new BannerView("ANCHORED_ADAPTIVE_AD_UNIT_ID", adaptiveSize, AdPosition.Bottom);
```

Replace <var class="readonly" translate="no">ANCHORED_ADAPTIVE_AD_UNIT_ID</var> with your ad unit ID.

With the anchored adaptive banner view created, you can now load the banner
as described in [Get Started guide](https://developers.google.com/admob/unity/banner.md.txt#load_a_banner_ad).