Before You Start

Before integrating ads unit in your app, you must:


Banners are rectangular, system-initiated ads that served in a designated area around your live app content.

BannerAd Formats:

Image text


Step 1. Init Banner Ad

The AdTiming SDK fires several events to inform you of Banner Ad activity. To display Banner Ads, one needs to create a brand new BannerAd object, setup its listeners and load the ads.

The following snippet demonstrates how to use the BannerAd class to create BannerAd objects and implement the BannerAdListener interface to receive Banner Ad events. The SDK will notify the Listener of all possible events listed below:

import com.adtiming.mediationsdk.banner.AdSize;
import com.adtiming.mediationsdk.banner.BannerAd;
import com.adtiming.mediationsdk.banner.BannerAdListener
BannerAd bannerAd = new BannerAd(activity, placementId,new BannerAdListener() {

       * Invoked when Banner Ad are available.
      public void onAdReady(View view) {
          // bannerAd is load success

       * Invoked when the end user clicked on the Banner Ad
      public void onAdClicked() {
         // bannerAd click

       * Invoked when the call to load a Banner Ad has failed
       * String error contains the reason for the failure.
      public void onAdFailed(String error) {
         // bannerAd fail
// default size


See table below for details about our supported standard banner sizes:

AdSize Description Dimensions in dp (WxH)
AdSize.BANNER Standard Banner 320 x 50
AdSize.MEDIUM_RECTANGLE Medium Rectangular Banner 300 x 250
AdSize.LEADERBOARD LeaderBoard Banner 728 x 90
AdSize.SMART Smart Banner
(Adjusted for both mobile and tablet)
If (screen height ≤ 720) 320 x 50
If (screen height > 720) 728 x 90


Step 2. Load BannerAd

Invoke loadAd method to request and cache the Banner Ad before it is available for display to users. It is strongly recommended to invoke this method a short while before the ad is to be shown.  



  • The loadAd method could be called multiple times at any time, but we do not recommend continuous requests for a short period of time. Many requests in a short period of time have no added value because the opportunities of available for inventory is unlikely at this time. 
  • !Warning: Attempting to load a new ad from the onAdFailed() methods is strongly discouraged. If you must load an ad from onAdFailed() ensure to limit ad load retries to avoid continuous failed ad requests in situations such as limited network connectivity.
  • Please do not request Banner ads regularly in the application, AdTiming SDK will automatically refresh Banner ads regularly.


Step 3. Show BannerAd

After the Banner Ad is successfully loaded by calling the loadAd in Step 2, you will be notified when the ad is ready to be shown through the onAdReady callback which will inform you the availability of ad inventory. 

Once you receive the onAdReady callback, you  can use code below to show and serve the Banner Ad to your users.

 private RelativeLayout adParent;
 adParent = this.findViewById(;

 public void onAdReady(View view) {
    // bannerAd is loaded successfully
    if (null != view.getParent()) {
        ((ViewGroup) view.getParent()).removeView(view);
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
    RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    adParent.addView(view, layoutParams);

■ code as following:




Step 4. Destroy BannerAd Object

It is recommended to invoke destroy method to release BannerAd object when the Activity be destroyed.

public void onDestroy() {
if (bannerAd != null) {


Step 5. Integrate a Banner Provider

You can find the supported networks below, and bannerSize behaviour for each network below:

AdMob Banner Medium Rectangle Leaderboard Smart
Facebook Banner Medium Rectangle Leaderboard Banner / Leaderboard
MoPub Banner Medium Rectangle Leaderboard Banner / Leaderboard
UnityAds Banner   Leaderboard Banner / Leaderboard
Vungle Banner   Leaderboard Banner / Leaderboard
AppLovin Banner Medium Rectangle Leaderboard Banner / Leaderboard
IronSource Banner Medium Rectangle Leaderboard Smart
Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.