AATKit Android Integration
Release Notes
  • Start
    • Setup
      • Maven
      • Prerequisites
      • Google Family Safe Apps
    • Initialization
    • Consent
      • General Handling
      • Managed Consent
        • Google CMP
        • Sourcepoint CMP
        • SFBX (AppConsent) CMP
      • Vendor Consent
      • Simple Consent
    • Plugins documentation
    • Additional Information
  • Formats
    • Introduction
    • Banner
      • Auto Load Banner
      • Multi-Size Auto Load Banner
      • Banner Cache
      • Infeed Banner
      • Sticky Banner
      • Multi-Size Banner
    • Fullscreen (Interstitial)
    • AppOpen (Google)
    • Rewarded Video
      • Server-Side Verification (SSV)
    • Native Ad
      • Basic Integration
      • Network Specifics
        • Native Ads: Google
        • Native Ads: FacebookAudienceNetwork
        • Native Ads: Huawei
  • Ad Networks
    • Customize Ad Networks
    • Google Mobile Ads SDK
    • AppLovin Ad Review
    • AppNexus special settings
    • FeedAd Shutter Colour and Disabling Spinner
    • Kidoz
  • Advanced
    • Targeting
      • Key-Value Targeting
      • User Targeting
      • Content Targeting URL
    • Frequency Capping
    • Advanced Listeners
      • Reports Delegate
      • Impression Listener (ILRD)
      • Statistics Listener
    • AATKit's Size
    • Ad Space and Fill Rate
    • Shake Debug
    • Child-directed Support
    • Geo Tracking
    • Disabling Ad Networks
    • Huawei Support
    • Creatives History
  • Other
    • AdMob Custom Events
    • Reference
      • Classes
        • AATKit
        • AATKitUserTargeting
        • CollapsibleBannerOptions
        • AATKitDebugScreenConfiguration
        • PlacementDebugInfo
        • AATKitDebugInfo
        • AATKitConfiguration
        • AATKitRuntimeConfiguration
        • ManagedConsent
        • VendorConsent
        • SimpleConsent
        • BannerConfiguration
        • BannerRequest
        • BannerCacheConfiguration
        • AATKitReward
        • NativeAdRating
        • AATKitImpression
        • PriceInfo
        • AdInfo
        • RewardedAdSSVInfo
        • PlacementHistoryInfo
        • AATKitAdNetworkOptions
          • SuperAwesomeOptions
          • FeedAdOptions
          • AppNexusOptions
          • AdMobOptions
          • DFPOptions
      • Interfaces
        • CacheStatusDelegate
        • AATKit.Delegate
        • BannerCache
        • BannerRequestCompletionListener
        • ManagedConsentDelegate
        • VendorConsentDelegate
        • Placement
        • StickyBannerPlacement
        • StickyBannerPlacementListener
        • MultiSizeBannerPlacement
        • MultiSizeBannerPlacementListener
        • InfeedBannerPlacement
        • InfeedBannerPlacementListener
        • BannerRequestDelegate
        • CacheDelegate
        • FullscreenPlacement
        • FullscreenPlacementListener
        • AppOpenAdPlacement
        • AppOpenPlacementListener
        • RewardedVideoPlacement
        • RewardedVideoPlacementListener
        • NativeAdPlacement
        • NativePlacementListener
        • NativeAdData
        • AutoLoadBannerPlacement
        • AutoLoadBannerPlacementListener
        • AutoLoadMultiSizeBannerPlacement
        • AutoLoadMultiSizeBannerPlacementListener
        • ReportsDelegate
        • ImpressionListener
        • StatisticsListener
      • Enumerations
        • AATKitGender
        • AdNetwork
        • ManagedConsentState
        • NonIABConsent
        • BannerPlacementSize
        • BannerSize
        • MediationType
        • ImpressionPricePrecisionType
  • Samples
  • Other Platforms
Powered by GitBook
On this page
  • Create Placement
  • Listen to Callbacks (Optional)
  • Get the Banner View
  • Request Ad
  • Banner Content Gravity
  • Complete Code Example
  1. Formats
  2. Banner

Sticky Banner

Integrate Sticky Banners

Last updated 20 days ago

This placement type is deprecated. We recommend using the new type instead.

A sticky banner placement serves as a container for banner ads. It is commonly used as a static, constantly shown, part of the app’s presentation. The ad content of the banner changes over time. To create a placement you need to specify its name and size.

Create Placement

To create an instance of , use the following API:

StickyBannerPlacement placement = AATKit.createStickyBannerPlacement("<PLACEMENT_NAME>", BannerPlacementSize.Banner320x53);
val placement = AATKit.createStickyBannerPlacement("<PLACEMENT_NAME>", BannerPlacementSize.Banner320x53)

You have to specify a placement name and the size argument of the type which specifies the size of the ad to be displayed.

Listen to Callbacks (Optional)

Through the use of , you can listen to the different placement callbacks.

placement.setListener(this);
placement.listener = this

Get the Banner View

The sticky banner placement provides a banner ad view once and will keep responsible for refreshing the displayed ad content over time. So, once you’ve created the placement, get the ad container view via method getPlacementView() and display it on the screen. If auto-reloading is used, the placement will update the view content once it has got a new ad.

View bannerView = placement.getPlacementView();
myBannerFrame.addView(bannerView);
val bannerView = placement.getPlacementView()
myBannerFrame.addView(bannerView)

Request Ad

You can load ads for the sticky banner placement either automatically (recommended) or manually.

Automatic Reload

To automatically load (and reload) the sticky banner placement enable auto-reload. If you do not set the refresh time interval seconds explicitly, AATKit will

  • Reload every 30 seconds (if no refresh time interval is set on the Dashboard)

  • Respect the refresh time interval setting of the Dashboard (which means, you can configure the interval without having to re-publish your app)

Note: if you make use of automatic reload, please make sure to disable (or not enable) automatic banner refresh at your ad networks of choice. Otherwise, the different auto reloads would interfere with each other.

// reload the banner placement every 30 seconds.
placement.startAutoReload();
// OR set refresh time manually
placement.startAutoReload(45);
// reload the banner placement every 30 seconds.
placement.startAutoReload()
// OR set refresh time manually
placement.startAutoReload(45)

The minimum refresh time is 30 seconds.

This needs to stop the auto-reload when it is no longer needed (e.g. if the view controller presenting ads will disappear):

placement.stopAutoReload();
placement.stopAutoReload()

Manual Load

To manually load the sticky banner placement:

placement.reload();
// Or using force load
placement.reload(true);
placement.reload()
// Or using force load
placement.reload(true)

Force Load

  • false (default): reload() will respect the current time interval.

  • true: reload() will immediately reload (irrespective of the fact when the last ad was loaded). This can be useful if the same sticky banner placement is used on various different pages of the app and you want to load a new ad every time the user navigates to another page (while still using auto-reloading).

Banner Content Gravity

placement.setContentGravity(Gravity.CENTER);
placement.setContentGravity(Gravity.CENTER)

The above image is for a placement created with size 375x50 while the loaded ad is 320x50. The red background is the placement ad container after setting the gravity to Gravity.RIGHT (the red colour is just used here for explanatory purposes).

Complete Code Example

private StickyBannerPlacement placement = AATKit.createStickyBannerPlacement("<PLACEMENT_NAME>", BannerPlacementSize.Banner320x53);

@Override
protected void onResume() {
    super.onResume();
    // [IMPORTANT] Notify AATKit about activity lifecycle
    AATKit.onActivityResume(this);

    // Set placement listener to listen to the callbacks
    placement.setListener(this);

    // (optional) Set ad view alignment inside the placement view
    placement.setContentGravity(Gravity.CENTER);

    // Get the banner view
    View bannerView = placement.getPlacementView();
    myBannerFrame.addView(bannerView);

    // reload the banner placement every 30 seconds.
    placement.startAutoReload();
    // OR set refresh time manually
    placement.startAutoReload(30);
}

@Override
protected void onPause() {
    // [IMPORTANT] Stop placement auto-reload
    placement.stopAutoReload();
    // [IMPORTANT] Notify AATKit about activity lifecycle
    AATKit.onActivityPause(this);
    super.onPause();
}

// StickyBannerPlacementListener implementation
@Override
public void onPauseForAd(@NonNull Placement placement) {
    // App is paused after banner got clicked
}

@Override
public void onResumeAfterAd(@NonNull Placement placement) {
    // Back to the app after clicking on the ad
}

@Override
public void onHaveAd(@NonNull Placement placement) {
    // The placement has loaded a new ad
}

@Override
public void onNoAd(@NonNull Placement placement) {
    // The placement could not load a new ad
}
private val placement = AATKit.createStickyBannerPlacement("<PLACEMENT_NAME>", BannerPlacementSize.Banner320x53)

protected override fun onResume() {
    super.onResume()
    // [IMPORTANT] Notify AATKit about activity lifecycle
    onActivityResume(this)

    // Set placement listener to listen to the callbacks
    placement.listener = this

    // (optional) Set ad view alignment inside the placement view
    placement.setContentGravity(Gravity.CENTER)

    // Get the banner view
    val bannerView = placement.getPlacementView()
    myBannerFrame.addView(bannerView)

    // reload the banner placement every 30 seconds.
    placement.startAutoReload()
    // OR set refresh time manually
    placement.startAutoReload(30)
}

protected override fun onPause() {
    // [IMPORTANT] Stop placement auto-reload
    placement.stopAutoReload()
    // [IMPORTANT] Notify AATKit about activity lifecycle
    onActivityPause(this)
    super.onPause()
}

// StickyBannerPlacementListener implementation
fun onPauseForAd(placement: Placement) {
    // App is paused after banner got clicked
}

fun onResumeAfterAd(placement: Placement) {
    // Back to the app after clicking on the ad
}

fun onHaveAd(placement: Placement) {
    // The placement has loaded a new ad
}

fun onNoAd(placement: Placement) {
    // The placement could not load a new ad
}

If the placement is created with a size larger than the banner ad size (), you can align the banner ad inside the placement view. To set the ad alignment, use the setContentGravity(gravity: Int) API passing the proper .

Auto Load Banner
StickyBannerPlacement
BannerPlacementSize
StickyBannerPlacementListener
see placement creation
Gravity
A 375x50 placement displaying a 320x50 banner ad