Inline ads, commonly referred to as “banners” or “rectangles”, are ad units that appear inline with other app content. Inline Ads are often found at the top or bottom of a mobile device’s screen while reading articles and searching through content. We recommend using inline ads on both smartphones and tablets in cases where the user is reading and/or interacting with content on the same screen for a period of time.
Integrating Inline Ad Placements
To add an inline ad to an application, import the required classes, instantiate an inline ad factory, load the ad, and attach it to the app’s view hierarchy.
1. Import the required classes
Import the following into the Android activity or iOS view controller that will contain the ad.
The Inline ad factory callbacks communicate events related to ad loading, such as success/failure of an ad load or load/update of the cache. These are implemented as an interface (Android) and delegates (iOS). Please refer to the API documentation for Android and iOS for a complete list of available callbacks.
The inline ad callbacks provide information about events related to the ad, such as click events, expand/collapse, resize, and errors. These are implemented as an interface (Android) and delegate methods (iOS). Please refer to the API documentation for Android and iOS for complete list of available callbacks.
After the ad is loaded, the ad factory will call back to the onLoaded (Android) or -didLoadInlineAd: (iOS) method with the ad. Each inline ad is provided as a view, and that view should be inserted at the appropriate place in the app’s view hierarchy. A common strategy is to set up a container view in the view hierarchy, so that the ad view can be easily added to that container.