Creating a Banner Ad 🔗

To create a banner, use the Banner constructor and provide an Activity context, Chartboost location, size, and BannerCallback. A banner ad contains a BannerSize which corresponds to the following:

Name Field Size
Standard BannerSize.STANDARD 320 x 50
Medium BannerSize.MEDIUM 300 x 250
Leaderboard BannerSize.LEADERBOARD 728 x 90


val chartboostBanner = Banner(
    location = "location",
    callback = BannerCallbackImpl(),
    size = BannerSize.STANDARD,
    context = context,
Banner chartboostBanner = new Banner(context, "location", Banner.BannerSize.STANDARD, bannerCallback, null);

Chartboost’s banner extends Android View and thus can be added programmatically to your Android view layout.

After you’ve confirmed the ad has been loaded (preferably using the BannerCallback you had to provide in the banner constructor, see below for more details), you can call show() on the banner instance to actually show the banner ad.

  • We do not serve banner ads to apps that are opted-out of behavioral targeting.
  • You do not need to create a Banner Publishing Campaign on the Chartboost Dashboard. The banner ads are delivered through our Exchange. You only need to call on them via the SDK.
  • Your banner analytics are available in the App Analytics section of your Chartboost Dashboard.
  • Multiple banners can be displayed at once if desired.
  • Banner ads are limited to Android SDKs version 8.0.1 and above.
  • ChartboostBanner is a View subclass able to show banner ads. Unlike other ad types, the developer is responsible for integrating the banner with the app UI and presenting it to the user.

Showing Banner Ads 🔗

Every banner has a callback which must be provided when instantiating a new Banner. It gets notified by events related to the banner life-cycle by implementing the BannerCallback interface methods. The main method you should take into consideration is onAdLoaded(), which will inform the callback asynchronously when the ad is ready to be displayed. A typical implementation would be as follows.

  • override fun onAdLoaded(cacheEvent: CacheEvent, cacheError: CacheError?) {
        if (cacheError != null) {
            /* Handle error */
        } else {
  • public void onAdLoaded(CacheEvent cacheEvent, @Nullable CacheError cacheError) {
        if (cacheError != null) {
            /* Handle error */
        } else {

For a more detailed demo, please refer to our Java sample application.

Ad Identifier 🔗

All the non-error event objects passed as parameters in delegate method calls include an adID property.

This is a string that uniquely identifies a cached ad. It might help when working with Chartboost to identify faulty creatives.