Banner Ad Implementation in Mobile Application
Banner is simplest format by integration, but with most UX errors in production. Typical picture: banner jumps when loading and shifts content, size is fixed 320×50 (which Google already considers obsolete), on tablet — tiny stripe in middle of wide screen. All solved by correct size choice and layout management at integration stage, not after review.
Adaptive Banner Instead of Fixed
Google AdMob since version 19.x recommends adaptive banner instead of BANNER (320×50) and LEADERBOARD (728×90). Adaptive banner gets container width and selects optimal height itself:
// Android
val adSize = AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(context, adContainerWidth)
adView.setAdSize(adSize)
// iOS
let viewWidth = view.frame.inset(by: view.safeAreaInsets).width
let adaptiveSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSize(forWidth: viewWidth)
bannerView.adSize = adaptiveSize
Adaptive banner height — from 50 to 90 dp depending on width. This is important for layout: can't hardcode layout_height="50dp" — banner either gets cut or leaves empty space. Correct approach — listen to onAdLoaded and set height programmatically via adView.adSize.getHeightInPixels(context).
Content Jump Problem
Most annoying error with banner ads — when on banner load screen content shifts down. Google downgrades app rating for this. Solution: reserve space for banner before it loads.
On Android: container FrameLayout with fixed height wrap_content and initial visibility="invisible". After onAdLoaded — View.VISIBLE. Content doesn't jump, space already reserved.
On iOS with autolayout: add NSLayoutConstraint for banner height with initial value 0, update constraint after load via UIView.animate.
Sticky Banner at Screen Bottom
Most popular placement — fixed banner over tab bar or navigation bar. Nuance: on iPhone with Dynamic Island or notch account for safeAreaInsets.bottom. Banner covering home indicator, Apple rejects on review — seen several such cases.
bannerView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
bannerView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor),
bannerView.centerXAnchor.constraint(equalTo: view.centerXAnchor)
])
Update and Lifecycle
Banner must stop when app goes to background (onPause / applicationWillResignActive) and resume on return. Without this possible IllegalStateException on Android when trying to load new ad in inactive Activity.
Auto-refresh (60 sec default in AdMob) can be configured in console, not via SDK — this restriction is intentional. If different frequency needed — use AdView.pause() / resume() combined with manual timer.
Timelines for banner ad integration — 1–2 days including testing on different devices and screen sizes.







