All skills
google avatar

/google-mobile-ads-interstitial

@329fa26
by googlegoogle/skills21k stars
1,698

Provides instructions for implementing, integrating, or configuring Google Mobile Ads (GMA) SDK interstitial ads in Android, iOS, or Unity mobile applications. Use when the task involves setting up interstitial ads. Don't use for "rewarded interstitial" ads.

Use this Skill: https://skilld.dev/gh/google/skills/google-mobile-ads-interstitial

This session only. Nothing lands on disk.

referencesandroid-interstitial.md

≈529 tokens on demand. Your agent reads this file only when SKILL.md points to it.

AI Integration Agent Instructions for Interstitial Ads

Required Imports

Use the following imports to implement an interstitial ad:

import com.google.android.libraries.ads.mobile.sdk.common.AdRequest
import com.google.android.libraries.ads.mobile.sdk.common.AdLoadCallback
import com.google.android.libraries.ads.mobile.sdk.common.FullScreenContentError
import com.google.android.libraries.ads.mobile.sdk.common.LoadAdError
import com.google.android.libraries.ads.mobile.sdk.interstitial.InterstitialAd
import com.google.android.libraries.ads.mobile.sdk.interstitial.InterstitialAdEventCallback

Method Signatures

Use the following method signatures to implement interstitial ads:

The AdRequest object takes the ad unit ID:

AdRequest.Builder(adUnitId: String).build()

The method signature to load an ad from InterstitialAd:

fun load(
    adRequest: AdRequest,
    adLoadCallback: AdLoadCallback<InterstitialAd>
): Unit

The 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.

Interstitial ad workflow

  1. Load the ad

  2. Register for ad event callbacks

    • Set the adEventCallback on the InterstitialAd object.
      • Drop the reference to the interstitial ad when the ad is dismissed or fails to show.
  3. Show the ad

  4. Verify the implementation: Verify the build to ensure there are no compile errors:

    • Run gradle build -x test to confirm a successful clean build. Resolve any GMA SDK related compile errors.

Links

Additional documentation:

Source: SKILL.md on GitHub

No alerts8d3 checks · Risk SAFE
  • Gen Agent Trust Hub8d

    This skill provides instructions for integrating mobile ad components into Android, iOS, and Unity projects. It follows standard development practices, including build verification steps and references to official developer documentation.

  • Socket8d

    No alerts

  • Snyk8d

    Risk: LOW · No issues

Signed by skilld at 329fa26. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last week
metadata
{
  "version": "1.1.0",
  "category": "GoogleAds"
}

README badge

README badge for google/skills/google-mobile-ads-interstitial