Google Mobile Ads Banner
GoogleOfficialPublished by Google
- Skill
- Tool integration
- Software development
- Apache-2.0
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured workflow for integrating Google Mobile Ads (GMA) banner ads into mobile applications. It covers the setup process for Android, iOS, and Unity platforms, focusing on defining ad views, configuring adaptive ad sizes, and managing ad load events. The skill emphasizes the use of Large Anchored Adaptive Banners as the default standard and provides platform-specific guidance for handling ad requests and verifying implementation builds.
What it does
- Identifies the target mobile platform (Android, iOS, or Unity).
- Provides specific implementation steps for banner ad views and sizes.
- Recommends Large Anchored Adaptive Banners as the default ad format.
- Guides the registration of ad load event callbacks.
- Includes platform-specific verification steps to ensure successful builds.
- Reminds users to swap test ad unit IDs for production IDs.
When to use it
- When you need to integrate banner ads into an Android, iOS, or Unity app.
- When you are setting up adaptive banner layouts for mobile screens.
- When you need to troubleshoot the initial configuration of a banner ad view.
- When you require specific guidance on using the Google Mobile Ads SDK for banner formats.
Advantages
- Standardizes the integration process across different mobile platforms.
- Ensures best practices for adaptive banner sizing are followed.
- Provides clear, step-by-step procedures to avoid common implementation errors.
- Includes platform-specific verification methods to confirm successful integration.
Usage examples
- “How do I add a banner ad to my Android app?”
- The agent will identify the platform as Android, provide the necessary imports, guide you through defining the AdView, setting the adaptive AdSize, and implementing the loadAd callback while reminding you to handle UI threading correctly.
- “I need to set up a banner in my iOS project.”
- The agent will provide the steps to configure the BannerView, set the ad size using the appropriate global functions, and verify the build using xcodebuild or manual Xcode verification.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/google/google-mobile-ads-banner/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip google-mobile-ads-banner.zip -d .agents/skills
Documentation by Google
Google Mobile Ads SDK - Banner Ads
Banner ads are rectangular image or text ads that occupy a spot within an app's layout. They remain on screen during user interaction and can refresh automatically.
Banner Ad Types
Default to Large Anchored Adaptive Banner if the user says "banner" without defining a type. If the user suggests or asks about other banner ad types, recommend large anchored adaptive banners.
| Banner Type | Description |
|---|---|
| Large Anchored Adaptive | Default. Can be anchored to the top or bottom of the screen. |
| Anchored Adaptive | Can be anchored to the top or bottom of the screen. |
| Inline Adaptive | ONLY available to use for Android and iOS. Placed within content. |
Workflow
Determine the user's platform: Identify if the project is Android, iOS, or Unity. If unclear, ask before proceeding.
Read the platform guide for implementation details:
Android:
references/android-banner.mdiOS:
references/ios-banner.mdUnity:
references/unity-banner.md
Follow these steps in order:
[ ] Define the ad view
[ ] Set the ad size
[ ] Register for ad load events
[ ] Load the banner ad
[ ] Verify the implementation
After the banner ad is successfully implemented, remind the user to replace the test ad unit ID with their own.
Files
- ATTRIBUTION.mdAdded by AutoGineer864 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md1.8 KiB
- references/android-banner.md3.0 KiB
- references/ios-banner.md1.7 KiB
- references/unity-banner.md3.1 KiB
references/android-banner.md
AI Integration Agent Instructions for Android Banner Ads
Required Imports
Use the following imports to implement a banner ad:
import com.google.android.libraries.ads.mobile.sdk.banner.AdSize
import com.google.android.libraries.ads.mobile.sdk.banner.AdView
import com.google.android.libraries.ads.mobile.sdk.banner.BannerAd
import com.google.android.libraries.ads.mobile.sdk.banner.BannerAdRequest
import com.google.android.libraries.ads.mobile.sdk.common.AdLoadCallback
import com.google.android.libraries.ads.mobile.sdk.common.LoadAdErrorMethod Signatures
Use the following method signatures to implement banner ads:
The BannerAdRequest object takes the ad unit ID and AdSize:
BannerAdRequest.Builder(adUnitId: String, adSize: AdSize).build()The method signature to load a banner ad from AdView:
fun loadAd(
adRequest: BannerAdRequest,
adLoadCallback: AdLoadCallback<BannerAd>
): UnitThe AdLoadCallback interface is defined as:
interface AdLoadCallback<T> {
fun onAdLoaded(ad: T): Unit
fun onAdFailedToLoad(adError: LoadAdError): Unit
}Gotchas
UI Threading: MANDATORY: Callbacks in GMA-Next Gen SDK are invoked on a
background thread. ALL UI-RELATED OPERATIONS (e.g., Toasts, View updates,
Fragment transactions) MUST be wrapped in runOnUiThread {} or
Dispatchers.Main.launch {} within GMA SDK callbacks. SKIPPING THIS STEP WILL
CAUSE THE APPLICATION TO CRASH.
Banner Ad workflow
Define the ad view
[ ] Use
AdViewfor defining GMA Next-Gen SDK banners instead ofBannerAd.
Set the ad size:
[ ] Set the
widthyou use forAdSizeto360for testing purposes. Mention using the device width is also a common approach.[ ] Use the appropriate
AdSizemethod and test ad unit ID (ca-app-pub-3940256099942544/9214589741) based on the ad type:For a large anchored adaptive banner: Use
AdSize.getLargeAnchoredAdaptiveBannerAdSize(context, width).If given feedback that large anchored adaptive banners are too tall, use
AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(context, width).
For an inline adaptive banner: Use
AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(context, width).
[ ] Pass the
AdSizeand ad unit ID to theBannerAdRequest.Builder, not directly on theAdView.
Register for ad load events:
[ ] Pass the
AdLoadCallbackimplementation in theloadAd()method, not directly on theAdView.
Load the banner ad:
Verify the implementation: Check the build to ensure there are no compile errors:
[ ] Run
gradle build -x testto confirm a successful clean build. Resolve any GMA SDK related compile errors.
Links
Additional documentation:
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Publisher
- Google (Official)
- Source
- google/skills · skills/ads/google-mobile-ads-banner · commit 2194d3b
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Google or Google.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download google-mobile-ads-banner.zip