Generated banner for Google Mobile Ads Rewarded
Generated logo for Google Mobile Ads Rewarded

Google Mobile Ads Rewarded

GoogleOfficialPublished by Google

  • Skill
  • Tool integration
  • Software development
  • Apache-2.0
  • No issues found

From the author

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

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides technical guidance for integrating rewarded ads using the Google Mobile Ads (GMA) SDK. It outlines the necessary steps to load ads, register callbacks, and implement user opt-in UI elements for Android, iOS, and Unity platforms. The skill emphasizes the requirement for user-initiated ad viewing and provides platform-specific implementation details, including mandatory threading considerations for Android and Swift-specific patterns for iOS.

What it does

  • Provides step-by-step workflows for integrating rewarded ads.
  • Details required imports and method signatures for Android implementation.
  • Explains the use of async/await patterns for iOS rewarded ad loading.
  • Highlights mandatory UI threading requirements for Android callbacks.
  • Provides instructions for verifying build success across platforms.
  • Defines the requirement for explicit user opt-in UI elements.

When to use it

  • When you need to integrate rewarded ads into an Android, iOS, or Unity mobile application.
  • When you are setting up the loading and display logic for rewarded ad units.
  • When you need to troubleshoot build errors related to the Google Mobile Ads SDK.
  • When you need to ensure proper callback handling and UI thread management for ad events.

Advantages

  • Provides platform-specific guidance for Android, iOS, and Unity.
  • Includes critical warnings regarding UI thread safety to prevent application crashes.
  • Standardizes the workflow for ad loading and event registration.
  • Offers clear verification steps to ensure successful project compilation.

Usage examples

“How do I implement a rewarded ad in my Android app?”
The agent will provide the required imports, the load method signature, and the mandatory UI threading instructions for Android.
“What are the steps to show a rewarded ad in iOS?”
The agent will outline the workflow including loading the ad, setting the fullScreenContentDelegate, and using the present method with a reward handler.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/google/google-mobile-ads-rewarded/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip google-mobile-ads-rewarded.zip -d .agents/skills

Documentation by Google

Google Mobile Ads SDK - Rewarded Ads

Rewarded ads reward users with in-app items for interacting with full-screen ads. Rewarded ads are served after a user explicitly opts in to view a rewarded ad.

Workflow

  1. Determine the user's platform: Identify if the project is Android, iOS, or Unity. If unclear, ask before proceeding.

  2. Read the platform guide for implementation details:

    • Android: references/android-rewarded.md

    • iOS: references/ios-rewarded.md

    • Unity: references/unity-rewarded.md

  3. Follow these steps in order:

    • [ ] Load the ad

    • [ ] Register for ad event callbacks

    • [ ] Add a UI element to view the ad for a reward

    • [ ] Show the ad

    • [ ] Verify the implementation

Files

references/unity-rewarded.md

AI Integration Agent Instructions for Unity Rewarded Ads

Required Imports

Use the following imports to implement a rewarded ad:

using System;
using UnityEngine;
using GoogleMobileAds.Api;
using GoogleMobileAds.Common;

Rewarded Ad Workflow

  1. Load the ad:

    Use the static RewardedAd.Load() method passing the ad unit ID, an AdRequest object, and a completion callback (Action<RewardedAd, LoadAdError>):

    // Test ad unit IDs. Replace with your own ad unit IDs.
    #if UNITY_ANDROID
        string adUnitId = "ca-app-pub-3940256099942544/5224354917";
    #elif UNITY_IPHONE
        string adUnitId = "ca-app-pub-3940256099942544/1712485313";
    #else
        string adUnitId = "unused";
    #endif
    RewardedAd.Load(adUnitId, new AdRequest(),
        (RewardedAd ad, LoadAdError error) =>
        {
            if (error != null || ad == null)
            {
                // Handle the error.
                return;
            }
            rewardedAd = ad;
        });

    Always destroy any existing RewardedAd object before loading a new ad.

  2. Register for ad event callbacks:

    Subscribing to ad events on the RewardedAd object is optional and depends on your application requirements:

    • OnAdPaid: Subscribe to log estimated ad revenue (AdValue) for impression-level ad monetization tracking.

    • OnAdImpressionRecorded: Subscribe to track ad impressions in internal telemetry or third-party analytics platforms.

    • OnAdClicked: Subscribe to record user clicks on the ad.

    • OnAdFullScreenContentOpened: Subscribe to pause game audio, timers, or gameplay loops when the rewarded ad covers the screen.

    • OnAdFullScreenContentClosed: Subscribe to resume game audio or gameplay loops when the ad is dismissed. Destroy the RewardedAd object (rewardedAd.Destroy()) and reload another ad (RewardedAd.Load()) so a fresh ad is ready for the next transition point.

    • OnAdFullScreenContentFailed: Subscribe to log display errors if the rewarded ad fails to show.

    Ensure background ad callbacks interacting with Unity objects (UnityEngine) are explicitly scheduled on the main thread using MobileAdsEventExecutor.ExecuteInUpdate(), because Unity APIs are not thread-safe and must be called from the main thread.

    rewardedAd.OnAdFullScreenContentOpened += () =>
    {
        MobileAdsEventExecutor.ExecuteInUpdate(() =>
        {
            // Interact with UnityEngine objects on the main thread here.
        });
    };
  3. Add a UI element to view the ad for a reward:

    MANDATORY: You MUST explicitly mention or demonstrate adding an interactive UI element (such as a Button) to trigger ShowRewardedAd(). Rewarded ads must never show automatically.

  4. Show the ad:

    Check CanShowAd() on the RewardedAd object along with passing an Action<Reward> callback to the Show() method. Include a null check to avoid exceptions. Hook this method to an interactive UI Button:

    // Call this method from a UI Button click event:
    public void ShowRewardedAd()
    {
        if (rewardedAd != null && rewardedAd.CanShowAd())
        {
            rewardedAd.Show((Reward reward) =>
            {
                // Reward the user.
                Debug.Log($"Rewarded! Amount: {reward.Amount}, Type: {reward.Type}");
            });
        }
    }
  5. Verify the implementation: Ensure there are no compilation errors:

    • [ ] Verify the Unity Console has no C# script compile errors or missing GoogleMobileAds namespace references.

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
Google
Publisher
Google (Official)
Source
google/skills · skills/ads/google-mobile-ads-rewarded · 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.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download google-mobile-ads-rewarded.zip