Banner Integration for Android Legacy pre v8.4.0
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.
Starting from ironSource SDK 7.8.0, you can use a container as part of your banner integration. Learn more.
The multiple ad units APIs are available here, supported for SDK 8.4.0+
Step 1. Create Banner Layout
First, you’ll need to create a Banner view to configure the Banner.
- Initiate the Banner view by calling this method (in this example it’s the BANNER banner size):
IronSourceBannerLayout banner = IronSource.createBanner(Activity, ISBannerSize.BANNER);
See table below for details about our supported standard banner sizes:
ISBannerSize Description Dimensions in dp (WxH) BANNER Standard Banner 320 x 50 LARGE Large Banner 320 x 90 RECTANGLE Medium Rectangular (MREC) 300 x 250 SMART Smart Banner If (screen width ≤ 720) 320 x 50
If (screen width > 720) 728 x 90 - Another option is initiating the banner with Custom size, using this signature (WxH in dp):
IronSourceBannerLayout banner = IronSource.createBanner(Activity, new ISBannerSize(320, 50));
Step 2. 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:
banner.setLevelPlayBannerListener(new LevelPlayBannerListener() {
// Invoked each time a banner was loaded. Either on refresh, or manual load.
// AdInfo parameter includes information about the loaded ad
@Override
public void onAdLoaded(AdInfo adInfo) {}
// Invoked when the banner loading process has failed.
// This callback will be sent both for manual load and refreshed banner failures.
@Override
public void onAdLoadFailed(IronSourceError error) {}
// Invoked when end user clicks on the banner ad
@Override
public void onAdClicked(AdInfo adInfo) {}
// Notifies the presentation of a full screen content following user click
@Override
public void onAdScreenPresented(AdInfo adInfo) {}
// Notifies the presented screen has been dismissed
@Override
public void onAdScreenDismissed(AdInfo adInfo) {}
//Invoked when the user left the app
@Override
public void onAdLeftApplication(AdInfo adInfo) {}
});
You can view the full listeners implementation here.
- 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.
- Please make sure to set the listeners before SDK initialization. This will ensure the SDK sends all relevant information.
Step 3. Load Banner Ad Settings
- To load a Banner ad with the default settings, call the following method:
IronSource.loadBanner(banner);
- We support placements, pacing and capping for Banners on the LevelPlay 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(banner, (String)placement);
Step 4. Destroy the Banner Ad
To destroy a banner, call the following method:
IronSource.destroyBanner(banner);
A destroyed banner can no longer be loaded. If you want to serve it again, you must initiate it again.
Step 5. Integrate a Banner Provider
Next, integrate the ad network adapters to serve Banners through LevelPlay Mediation.
You can find the supported networks below, and bannerSize behaviour for each network below:
BANNER | LARGE | RECTANGLE | SMART | |
ironSource | Banner | Large Banner | Medium Rectangle | Banner / Leaderboard |
AdMob | Banner | Large Banner* | Medium Rectangle | Banner / Leaderboard |
APS | Banner | – | Medium Rectangle | Banner / Leaderboard |
AppLovin | Banner | Banner | Medium Rectangle | Banner / Leaderboard |
Chartboost | Banner | Banner | Medium Rectangle | Leaderboard |
Digital Turbine | Banner | Banner | Medium Rectangle | Banner / Leaderboard |
HyprMX | Banner | – | Medium Rectangle | Banner / Leaderboard |
InMobi | Banner | Banner | Medium Rectangle | Banner / Leaderboard |
Meta Audience Network |
Banner | Large Banner | Medium Rectangle | Banner / Leaderboard |
Pangle | Banner | Banner | Medium Rectangle | Banner / Leaderboard |
Smaato | Banner | – | Medium Rectangle | Banner / – |
UnityAds | Banner | Banner | Medium Rectangle | Banner / Leaderboard |
Vungle | Banner | Banner | Medium Rectangle | Banner / Leaderboard |
Banner Size Reference
- Banner: 320 X 50
- Large Banner: 320×90
- Medium Rectangle (MREC): 300×250
- LeaderBoard: 728X90
* AdMob define Large as 320X100
Step 6. Adaptive banners
Done!
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.