Banner Integration for Android

Banners are rectangular, system-initiated ads that can be either static or animated that are served in a designated area around your live app content.

Before You Start

  • Make sure that you have correctly integrated the ironSource SDK into your application. Integration is outlined here.
  • Banner Mediation is supported in ironSource SDK 6.6.0 and above.
  • You will need to integrate one of our mediation adapters with Banner support to serve this ad unit.

Step 1. Create Banner Layout 

First, you’ll need to create a Banner view to configure the Banner.

  • Instantiate the Banner view by calling this method:
    IronSourceBannerLayout mIronSourceBannerLayout = IronSource.createBanner(this, bannerAdSize);
    Note: You must define one of Banner sizes we support in order to set the BannerLayout. See table below.
    bannerAdSize Description Dimensions in dp (WxH) Ad Network Support
    BANNER Standard Banner
    Best for Phones & Tablets
    Screen Width x 50 Admob, AppLovin, Facebook, InMobi
    LARGE Large Banner Screen Width x 90 Admob, Facebook
    RECTANGLE Large Rectangular Banner
    Best for Scrollable Feeds or Between Game Levels
    300 x 250 Admob, AppLovin, Facebook, InMobi
    SMART Smart Banner
    Renders ads that automatically resize to fit the device’s size and orientation
    If (screen height ≤ 720) Screen Width x 50
    If (screen height > 720dp) Screen Width x 90
    Admob, AppLovin, Facebook, InMobi
  • Attach the Banner to your app’s existing view container in order to enable your users to view the Banner:
    FrameLayout mBannerParentLayout = (FrameLayout) findViewById(;
    FrameLayout.LayoutParams layoutParams = new 
    FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.MATCH_PARENT);
    mBannerParentLayout.addView(mIronSourceBannerLayout, 0, layoutParams);
Note: For Admob Banners
If you are leveraging Admob’s banner ads through ironSource Mediation, make sure all the parent containers for the banners do not have any width padding defined. This is necessary for the Admob Smart Banner as this ad unit adjusts to the optimal ad size in accordance with the width of the device in its current orientation. In order to calculate the width of the screen correctly, the padding properties must be removed.

Step 2. Override Your Activity Lifecycle Methods

Application Lifecycle
Override the onPause(), onResume() methods in each of your activities to call the corresponding ironSource methods as follows:

protected void onResume() {
   protected void onPause() {

Step 3. Implement the Listener

Next, implement the Banner Listener in your code. The ironSource SDK fires several callbacks to inform you of Banner activity. The SDK will notify your Listener of all possible events listed below:

mIronSourceBannerLayout.setBannerListener(new BannerListener() {
                public void onBannerAdLoaded() {
                public void onBannerAdLoadFailed(IronSourceError error) {
                public void onBannerAdClicked() {
                public void onBannerAdScreenPresented() {
                public void onBannerAdScreenDismissed() {
                public void onBannerAdLeftApplication() {
Note: Do not assume the callbacks are always running on the main thread. Any UI interaction or updates resulting from ironSource callbacks need to be passed to the main thread before executing.

Step 4. Load Banner Ad

To load a Banner ad, call the following method:


We support placements, as well as capping and pacing for Banners on the ironSource dashboard. Learn how to set up placements, capping and pacing for Banners to optimize your app’s user experience here.

If you’ve set up placements for your Banner, call the following method to serve a Banner ad in a specific location:

IronSource.loadBanner(mIronSourceBannerLayout, placement);

Once you receive the below callback from your Listener, you will be able to show the ad to your users:


Step 5. Destroy the Banner Ad

Once you’ve successfully served a Banner, we recommend calling the below function to destroy the previous Banner. This is necessary to serve an additional Banner in the same view.


After you call this method, the Banner in question can no longer be used. In the case you want to serve it again, you will need to create a new Banner using the createBanner method.

Step 6.  Integrate a Banner Provider

Next, integrate the ad network adapters to serve Banners through ironSource Mediation. We currently support Admob, AppLovinFacebook and Inmobi Banners.


You are now all set up to serve Banners in your application. Verify your integration with our Integration Helper.

What’s Next? 

Follow our integration guides to integrate additional ad units:


Interested in integrating more mediation adapters? Check out our supported Mediation Networks.