- November 21, 2025
- maulik.jadvani@gmail.com
- 0
Google Ads Integration in Flutter — A Complete Guide
This guide covers everything you need to integrate Google Mobile Ads (AdMob) into your Flutter app: setup, banner/interstitial/rewarded ads, testing, GDPR/consent, mediation, best practices and troubleshooting.
Overview
Google Mobile Ads (AdMob) is the official solution to monetize mobile apps with Google Ads. In Flutter, Google provides the google_mobile_ads plugin which abstracts platform-specific SDKs for Android and iOS. This guide explains how to integrate, test, and optimize ads in production-ready Flutter apps.
Setup & prerequisites
- Have a Flutter project ready (Flutter SDK & latest stable channel).
- Create an AdMob account at admob.google.com and register your app.
- Obtain your App ID for Android & iOS from AdMob.
- Use official plugin:
google_mobile_ads.
Install the plugin
flutter pub add google_mobile_ads
Android specific
Open android/app/src/main/AndroidManifest.xml and add your AdMob App ID inside the <application> tag (only required for older SDKs — recent plugin versions set it automatically; check docs):
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-XXXXXXXXXXXXXXXX~YYYYYYYYYY"/>
iOS specific
Open ios/Runner/Info.plist and add:
<key>GADApplicationIdentifier</key> <string>ca-app-pub-XXXXXXXXXXXXXXXX~YYYYYYYYYY</string>
Initialization & app lifecycle
Initialize the SDK as early as possible in your app, usually in main() before running the app.
import 'package:google_mobile_ads/google_mobile_ads.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
MobileAds.instance.initialize().then((InitializationStatus status) {
runApp(const MyApp());
});
}
The initialize() call returns an InitializationStatus you can inspect for diagnostics.
Banner Ads
Banner ads are persistent ad units that fit in a portion of the screen. Use BannerAd or the provided AdWidget for embedding.
Example: Banner ad widget
class BannerAdWidget extends StatefulWidget {
@override
_BannerAdWidgetState createState() => _BannerAdWidgetState();
}
class _BannerAdWidgetState extends State<BannerAdWidget> {
late BannerAd _bannerAd;
bool _isLoaded = false;
@override
void initState() {
super.initState();
_bannerAd = BannerAd(
adUnitId: 'ca-app-pub-3940256099942544/6300978111', // test id
size: AdSize.banner,
request: AdRequest(),
listener: BannerAdListener(
onAdLoaded: (_) { setState(() { _isLoaded = true; }); },
onAdFailedToLoad: (ad, err) { ad.dispose(); },
),
);
_bannerAd.load();
}
@override
void dispose() {
_bannerAd.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
if (!_isLoaded) return SizedBox.shrink();
return Container(
width: _bannerAd.size.width.toDouble(),
height: _bannerAd.size.height.toDouble(),
child: AdWidget(ad: _bannerAd),
);
}
}
Interstitial Ads
Interstitial ads are full-screen ads shown at natural breaks (e.g., level end). Load ahead of showing.
Example: load & show interstitial
InterstitialAd.load(
adUnitId: 'ca-app-pub-3940256099942544/1033173712', // test id
request: AdRequest(),
adLoadCallback: InterstitialAdLoadCallback(
onAdLoaded: (ad) { _interstitialAd = ad; },
onAdFailedToLoad: (err) { /* handle */ },
),
);
// later when ready
_interstitialAd?.show();
Dispose the ad after use. Verify appropriate user experience and frequency capping.
Rewarded Ads
Rewarded ads grant users an in-app reward after watching. Great for engagement and optional monetization.
Example: RewardedAd
RewardedAd.load(
adUnitId: 'ca-app-pub-3940256099942544/5224354917', // test id
request: AdRequest(),
rewardedAdLoadCallback: RewardedAdLoadCallback(
onAdLoaded: (ad) { _rewardedAd = ad; },
onAdFailedToLoad: (err) { /* handle */ },
),
);
// show
_rewardedAd?.show(onUserEarnedReward: (AdWithoutView ad, RewardItem reward) {
// grant reward
});
Mediation & eCPM optimization
AdMob Mediation lets you serve ads from multiple networks to maximize revenue. Configure mediation adapters and networks in the AdMob dashboard and include adapter SDKs in your app (via Gradle/CocoaPods).
Note: each mediation partner requires their own adapter and may require additional privacy disclosures.
GDPR, CCPA & user consent
If your app serves users in the EU, you must obtain consent for personalized ads. Google offers the User Messaging Platform (UMP) SDK for consent in mobile apps.
Basic UMP flow
- Integrate the UMP SDK via platform-specific setup (Android/iOS).
- Check consent status at startup and show consent form if required.
- Pass non-personalized flags in
AdRequestbased on consent.
Example: request non-personalized ads
AdRequest request = AdRequest(nonPersonalizedAds: true);
Always consult legal and follow Google policies for consent and user data handling.
Testing & Test IDs
Important: Use test ad unit IDs during development to avoid policy violations. AdMob provides official test ids (used in examples above).
You can also configure test devices:
RequestConfiguration requestConfiguration = RequestConfiguration( testDeviceIds: ['ABCDEF012345'] ); MobileAds.instance.updateRequestConfiguration(requestConfiguration);
Never ship apps with test ad unit IDs. Replace with production ad unit IDs before release.
Monetization strategy & UX
- Place ads where they don't interrupt core flows. Avoid accidental clicks.
- Use frequency caps and sensible pacing for interstitials and rewarded ads.
- Consider premium (ad-free) subscription as alternative revenue.
Analytics & monitoring
Track ad performance using AdMob reporting and link to Firebase Analytics for richer events. Monitor impressions, fill rate, eCPM, and click-through metrics.
Best practices & troubleshooting
- Initialization timing: initialize before first ad request.
- Memory: dispose ad objects to avoid leaks.
- Platform differences: check iOS vs Android behavior and set ad sizes accordingly.
- Ad policy compliance: don't encourage accidental clicks or incentivize clicks.
- Use official adapters: for mediation, use official adapters and follow integration docs.
Troubleshooting checklist
- No ads showing — check ad unit IDs and that account is active.
- Ads show as blank — ensure test ids for dev, check network and logs.
- Crashes on loading — check Gradle/CocoaPods dependencies and adapter versions.
Conclusion
Integrating Google Mobile Ads into Flutter lets you monetize with banners, interstitials, and rewarded ads. Follow testing best practices, obtain consent where necessary, and monitor performance to optimize revenue. If you want a production-ready, privacy-compliant integration, contact Zeus Technocrats.
