Mobile Ads API
The Amazon Mobile Ads API allows you to easily place high-quality display ads from the Amazon Mobile Ad Network in your app. The Amazon Mobile Ad Network can help you better monetize your apps and gain exclusive access to highly relevant ads from brand advertisers, including Amazon and its subsidiaries.
- How Do I Get Started?
- Available Tools, Libraries, and Interfaces
- Amazon Mobile Ad Network Concepts
How Do I Get Started?
Important: This guide assumes that you are an Android developer.
You can quickly add a new ad placement to an existing app by following the steps in the Quick Start Guide. To maximize your eCPM, please ensure that you provide Amazon Mobile Ad Network the first look and then fall back to other ad networks when ads are not available; you can see an example of how this can be done on the Using Amazon Mobile Ads API with Other SDKs page. Next, you'll want to verify that the ad placement is working correctly by following the Developer Launch Checklist in Testing your App. Lastly, you'll want to submit your app through the Amazon Apps & Games Developer Portal or Google Play.
Available Tools, Libraries, and Interfaces
The Amazon Mobile Ad Network provides a Java API for Android 2.3 and newer phones and tablets.
Amazon Mobile Ad Network Concepts
Auto Ad Size
The Amazon Mobile Ads API can be set to automatically choose an optimally sized banner ad and scale it to fit your ad view. The size chosen is based on the screen dimensions and pixel density of the device loading the ad as well as the dimensions of the view itself. To enable Auto Ad Size, simply leave out the AdSize parameter when defining your AdLayout in either Java or XML. Here is an example of how you would set the AdLayout within Java code:
this.adView = new AdLayout(this);
Here is an example of how you would set the AdLayout within an XML layout file:
<com.amazon.device.ads.AdLayout android:id="@+id/adview" android:layout_width="match_parent" android:layout_height="wrap_content"/>
Learn more about creating AdLayouts in the [Quick Start Guide].
Auto Ad Size Guidelines
- Auto Ad Size is designed for screen-wide banner ads. We recommend setting your AdLayout’s width to MATCH_PARENT and placing it within a layout whose width equals the screen’s width.
- We recommend setting the AdLayout’s height to WRAP_CONTENT to ensure that the ad will scale to fill the entire AdLayout. Alternatively, you can limit the ad’s height by setting it to a device-independent pixel value instead.
- On tablet-sized devices, including 7” tablets such as the Kindle Fire as well as larger tablets, banner ads of sizes 600x90, 728x90, or 1024x50 will be selected. On smaller devices, including most phones, banner ads of size 320x50 will be selected. If the chosen ad is smaller than its AdLayout then it will be upscaled to span one of the dimensions.
- On phone-sized devices, your AdLayout must be at least 320dp wide and 50dp high.
- On tablet-sized devices, your AdLayout must be at least 533dp wide and 79dp high, or at least 1024dp wide and 50dp high.
- Auto Ad Size is not applicable for interstitial ads.
Important: If your AdLayout is too small then no ad will be returned and ad loading will fail. You can ensure that your AdLayout is large enough for most scenarios by creating a screen-wide AdLayout with its width set to MATCH_PARENT and its height to WRAP_CONTENT.
Manual Ad Size
If you want to set the banner ad size yourself, you can specify a size in either the AdLayout constructor or through XML. Manually setting the size is recommended for ads that do not span the entire screen width and it's required for 300x250 ads. The Amazon Mobile Ad Network supports ad sizes of 320x50 and 300x250 for phones and 600x90, 728x90, 1024x50, and 300x250 for tablets. Your app should request a device-appropriate size, which will be scaled to your ad view. Ad sizes are specified in the AdLayout constructor or the XML layout file. Here is an example of how you would set the AdLayout within Java code:
this.adView = new AdLayout(this, AdSize.SIZE_320x50);
For setting the size through the Java code as in the above example, you must provide the AdLayout constructor with one of the following AdSize class fields:
Alternatively, you can also specify the size within an XML AdLayout initialization as follows:
<com.amazon.device.ads.AdLayout android:id="@+id/adview" android:layout_width="320dp" android:layout_height="50dp" Amazon:adSize="320x50"/>
Please see the following chart for recommended sizes by device:
|Ad Size||Android Phone||Android Tablet||Kindle Fire|
The Amazon Mobile Ad Network supports three ad types: static click-through banners, rich media expandable banners, and interstitial ads.
Static Banners - Static banners are HTML web views that typically open an in-app browser, native browser, or Android intent.
Rich Media Expandable Banners - Rich media expandable banners are HTML web views that expand in-app with rich interactive content, which includes playing of videos. The call to action in these ads typically includes opening an in-app browser, native browser, or Android intent.
Interstitials - An interstitial is a full-page ad that usually appears at a transition point in the app (e.g. game level transition). The full-page ad provides advertisers with a unique opportunity to engage with the audience in a meaningful way, leading to superior monetization for developers. See details below:
- Interstitial ads support an interactive in-app user experience.
- These ads are loaded in the background before it's time to display them. As a result, when the time comes for the ad to appear, the ad will materialize on the screen very quickly.
- Closing the ad requires user action; the user will always have the option to close the ad.
- Interstitial ads that have loaded but have not been displayed will eventually expire. If this occurs, a new ad must be loaded before interstitials can be shown.
Above the Fold
All ad placements must be above the fold, which means fully visible without scrolling. If an ad placement is embedded with content in a screen, it can scroll with that content and scroll off of the screen as long as it started above the fold.
Ad Reload Rate
The Amazon Mobile Ad Network recommends loading a new ad on screen navigations and device orientation changes when the ad view changes size. You may also want to refresh the ad after a set time interval. In this case, the Amazon Mobile Ad Network recommends a refresh rate of 30 to 60 seconds. Faster ad refresh intervals could result in blocked ad requests. Please note that the Amazon Mobile Ads API does not provide any built-in functionality for automatically refreshing ads.