Loading Ads from Multiple SDKs
The Amazon Mobile Ads API for Android can be used in conjunction with other advertising SDKs. We recommend providing the Amazon Mobile Ad Network with the first look. Before loading an Amazon Ad you'll want to implement an
AdListener, which has callbacks for success and failure. If no ads were available from the Amazon Mobile Ad Network, then the
AdListener.onAdFailedToLoad callback method can be used to call another ad SDK.
Below is a simple example of a program that first tries to load an ad from the Amazon Ad Network. On failure, it makes a second ad request via AdMob's SDK.
Mediator SDK Integration
Banner ads from the Amazon Mobile Ad Network can also be retrieved through select mediator SDKs. General guidelines for integration are listed below.
Note: The following guidelines only apply to users attempting to load banner ads from the Amazon Mobile Ad Network through a third-party mediator SDK.
1) Apps that reload ads in such a way that new ads replace existing ads on the same screen (for example, apps that reload ads on a time interval) will need to take special measures to ensure that new ads cannot load while the user is already interacting with an expanded rich media ad. This can be accomplished in a number of ways:
- (RECOMMENDED) Introduce logic to prevent ad loading actions from initiating if an ad has expanded. For example, you can define a boolean variable
isExpandedthat is set to true upon ad expansion and set to false upon ad collapse, and you can then check to make sure that
isExpandedequals false as a condition for requesting an ad from the mediator SDK. You will need to combine this solution with one of the others listed below to handle the case where an ad begins loading before the current ad is expanded.
- (RECOMMENDED) Load new ads in a separate, invisible ad view, swapping that ad view with the current one only after the ad has finished loading. We recommend you combine this solution with the above solution to ensure that new ads do not begin loading while the current ad is expanded.
- (RECOMMENDED) Remove automatic ad refresh behavior except in cases where the parent view is destroyed.
- Destroy the existing ad view when loading a new ad.
- Disable clicking while an ad is in the process of loading, and re-enable only after a new ad has loaded.
2) You must ensure that the
AdActivity activity is declared in your
AndroidManifest.xml file. See Step 2 of the Quick Start Guide for details.
3) Remember that all apps utilizing the Amazon Mobile Ad Network, even those that do so through a mediator's SDK, must pass the criteria outlined in the Developer Launch Checklist prior to submission. You will need to contact your mediator to enable Amazon Test ads before testing starts, and you will also need to contact your mediator to disable Amazon Test ads after testing has been completed. Please contact your mediator for specific supplemental information regarding integrating the Amazon Mobile Ad Network through its SDK.