How to Change Ad Type and Ad IDs
Everything ad-related is centralized in lib/constants/ad_config.dart:
class AdConfig {
/// Master switch. `false` disables every ad (interstitial + rewarded) app-wide.
static const bool adsEnabled = true;
/// `true` shows Google AdMob rewarded ads, `false` falls back to Unity Ads.
static const bool wantGoogleAd = true;
/// AdMob rewarded ad unit id — ships with Google's public test ID, replace before release.
static const String rewardedAdID = 'ca-app-pub-XXXXXXXXXXXXXXXX/XXXXXXXXXX';
/// AdMob interstitial ad unit id — ships with Google's public test ID, replace before release.
static const String interstitialAdID = 'ca-app-pub-XXXXXXXXXXXXXXXX/XXXXXXXXXX';
/// Unity Ads game id — ships with Unity's public test ID, replace before release.
static final String unityGameId = Platform.isAndroid ? 'XXXXXXX' : 'XXXXXXX';
// unityRewardedPlacementId / unityInterstitialPlacementId also live here.
/// Max rewarded-ad coin claims allowed per calendar day.
static const int adLimit = 5;
/// Coins credited per rewarded-ad watch.
static const int adRewardAmount = 50;
}
- Choose your ad network — set
wantGoogleAdtotruefor Google AdMob, orfalseto use Unity Ads instead. - Google AdMob — replace
rewardedAdIDandinterstitialAdIDwith your real ad unit IDs from the AdMob console. Format:ca-app-pub-XXXXXXXXXXXXXXXX/XXXXXXXXXX— your publisher ID, then the ad unit number. For account setup, app registration, and creating ad units step by step, see the Google AdMob Setup Guide. - Unity Ads — replace
unityGameId, and the placement IDs returned byunityRewardedPlacementId/unityInterstitialPlacementId, with your own from the Unity Ads dashboard. - Daily reward limit / reward amount — change
adLimit(max rewarded-ad claims per day) andadRewardAmount(coins per watch).
App-level Ad IDs
Separately from the ad unit IDs above, both platforms also need your AdMob App ID (not an ad unit ID) registered at the platform level:
- Android —
android/app/src/main/AndroidManifest.xml, under thecom.google.android.gms.ads.APPLICATION_IDmeta-data tag. - iOS —
ios/Runner/Info.plist, under theGADApplicationIdentifierkey.
The App ID uses a ~ (not /) and looks like ca-app-pub-XXXXXXXXXXXXXXXX~XXXXXXXXXX. Find it in the AdMob console under Apps → your app → App settings, or in the Google AdMob Setup Guide.
For full platform setup (manifest permissions, Info.plist entries, SDK init), see the google_mobile_ads platform setup guide.