Google Mobile Ads Rewarded
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 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
Download the skill as a ZIP:
https://autogineer.com/agent-skills/google/google-mobile-ads-rewarded/downloadUnzip 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
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-rewarded.mdiOS:
references/ios-rewarded.mdUnity:
references/unity-rewarded.md
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
- ATTRIBUTION.mdAdded by AutoGineer868 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md1.1 KiB
- references/android-rewarded.md2.4 KiB
- references/ios-rewarded.md1.5 KiB
- references/unity-rewarded.md3.8 KiB
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
Load the ad:
Use the static
RewardedAd.Load()method passing the ad unit ID, anAdRequestobject, 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"; #endifRewardedAd.Load(adUnitId, new AdRequest(), (RewardedAd ad, LoadAdError error) => { if (error != null || ad == null) { // Handle the error. return; } rewardedAd = ad; });Always destroy any existing
RewardedAdobject before loading a new ad.Register for ad event callbacks:
Subscribing to ad events on the
RewardedAdobject 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 theRewardedAdobject (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 usingMobileAdsEventExecutor.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. }); };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.Show the ad:
Check
CanShowAd()on theRewardedAdobject along with passing anAction<Reward>callback to theShow()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}"); }); } }Verify the implementation: Ensure there are no compilation errors:
[ ] Verify the Unity Console has no C# script compile errors or missing GoogleMobileAds namespace references.
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-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 or Google.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download google-mobile-ads-rewarded.zip