Native Ads Express

This guide shows you how to use the Google Mobile Ads SDK to display AdMob Native Express ads in Android applications. It covers adding a NativeExpressAdView to a layout, how to request ads, and so on.


This guide assumes some working knowledge of the Google Mobile Ads SDK. If you haven't already done so, consider running through Get Started in Android Studio.

What's a Native Express ad?

Native Express ads are similar to banners in that they're rectangular ads that you can drop into a layout and size how you like. The key difference is that you, the publisher, can control the ad's presentation details (things like image sizes, fonts, colors, and so on) by uploading a CSS template for your ad unit. AdMob combines that template with advertiser assets like icons, images, and text, and displays the result in a NativeExpressAdView. This approach minimizes the amount of Java code needed for Native Ads Express, while helping publishers display ads that look natural in their app.

Create a Native Ads Express ad unit

Native Ads Express ad units are created at For a description of the format and more information on choosing a template size for your ad units, see Overview of native ads express. For more information on writing CSS code that gives your Native Express ads a natural, unobtrusive style, see the Guide to custom CSS for native ads express.


The NativeExpressAdView class is responsible for requesting and displaying Native Express ads. Here's an example NativeExpressAdView element that might appear in an XML layout file:


The attributes of the element should be set as follows:

  • android:layout_height and android:layout_width should both be set to wrap_content.
  • ads:adUnitId should be set to a valid Native Ads Express ad unit ID. You can insert an ad unit ID or use a reference to a string resource (@string/my_ad_unit for example).
  • ads:AdSize should be the desired size for the Native Express ad. Sizes of the form WIDTHxHEIGHT are typical, though there are some other options, as you'll see in the next section.

Choose a size

Rather than forcing publishers to choose among fixed sizes, Native Ads Express offers several template sizes (chosen when creating an ad unit), each with a range of height and width values in device-independent pixels (dp):

Template size Min width Max width Min height Max height
Small 280 1200 80 612
Medium 280 1200 132 1200
Large 280 1200 250 1200

A publisher who wants to display a medium template size can use widths between 280 and 1200 dp and heights from 132 to 1200 dp. That means that 300 by 200, 450 by 150, and 613 by 572 are all valid for the medium template size. Bear in mind, though, that not all sizes are likely to make for a good presentation. While it's technically possible to request a small template with a size of 1200 by 80, it's probably not the best choice! Also, be sure to consider the screen dimensions of the device on which you're displaying the ad. Larger sizes should generally be reserved for presentation on tablets.

Apps aren't required to use the same size for every request. The same ad unit could be requested with one size in portrait orientation and another in landscape, or in different sizes according to the particular device it's running on. In the event that an app makes a request with an ad size that falls outside the range for the ad unit's template, though, an error could be returned.

Publishers can also use the FULL_WIDTH constant when programmatically creating an AdSize for a NativeExpressAdView. In this case, the ad occupies the entire width of the device screen.

At this time, the AUTO_HEIGHT constant and FLUID ad size should not be used with Native Ads Express.

Load an ad

Loading ads is done by calling the loadAd method in NativeExpressAdView. This method accepts an AdRequest object that publishers can use to add information to the request: (excerpt)

NativeExpressAdView adView = (NativeExpressAdView)findViewById(;

AdRequest request = new AdRequest.Builder()

Native video

In addition to images, text, and numbers, some native ads contain video assets. At the current time, this is limited to the app install format, but may be extended to content ads in the future.

To simplify the configuration and display of video, the Mobile Ads SDK provides the following video-related classes for Native Ads Express:


The VideoOptions class allows apps to configure how native video assets should behave. VideoOptions objects can be assigned to a NativeExpressAdView via the setVideoOptions method.

mNativeExpressAdView.setVideoOptions(new VideoOptions.Builder()

The VideoOptions.Builder class currently offers one method, setStartMuted, which tells the SDK whether video assets should start in a muted state. The default value is true.


The VideoController class is used to retrieve information about video assets. Apps can get a reference to the controller from a NativeExpressAdView by calling getVideoController

VideoController vc = myNativeExpressAdView.getVideoController();

This method always returns a VideoController object, even when no video asset is present in the ad.

VideoController offers these methods for querying video state:

  • hasVideoContent() - Returns true if the ad has a video asset, and false if it doesn't.
  • getAspectRatio() - Returns the aspect ratio of the video (width/height), or zero if no video aspect is present.

Apps can also use the VideoController.VideoLifecycleCallbacks class to get notifications when events occur in the lifecycle of a video asset.

VideoController vc = mNativeExpressAdView.getVideoController();

vc.setVideoLifecycleCallbacks(new VideoController.VideoLifecycleCallbacks() {
    public void onVideoEnd() {
        // Here apps can take action knowing video playback is finished
        // It's always a good idea to wait for playback to complete before
        // replacing or refreshing a native ad, for example.

Next steps

For more information on the best ways to use Native Ads Express, check out these resources:

Send feedback about...

AdMob by Google
AdMob by Google