First Time Configuration
Admob Config

AdMob Configuration

Note

You can either use Admob or AppLovin, this app contains the configuration for both but only one ad network can be used. Choose one network and follow the instructions.

Overview

AdMob is Google’s mobile app advertising platform designed specifically for mobile apps. AdMob is used by developers and advertisers to monetize their mobile applications through in-app advertising. With AdMob, developers can earn revenue from their applications by displaying in-app ads from advertisers. In this guide, we will learn how to configure AdMob in a Flutter application.

Steps

1. Create an AdMob account

To use AdMob in your Flutter app, you must first create an AdMob account. You can sign up for an AdMob account at https://admob.google.com/home/sign-up/ (opens in a new tab).

2. Add App

  1. Log in to your AdMob account.
  2. Click on the “Apps” tab.
  3. Click the “Add App” button.
  4. Select your app platform (Android or iOS).
  5. Enter your app name and click “Add”.

3. Add Interstitial Ad Unit

  1. Click on the newly created app.
  2. Click on the “Ad Units” tab.
  3. Click the “Add Ad Unit” button.
  4. Select 'Intersitial Ad' ad type.
  5. Fill in the required details and click “Create Ad Unit”.

4. Add Rewarded Ad Unit

  1. Click on the newly created app.
  2. Click on the “Ad Units” tab.
  3. Click the “Add Ad Unit” button.
  4. Select 'Rewarded Ad' ad type.
  5. Fill in the required details and click “Create Ad Unit”.

5. Replace the App Id for Android in 'AndroidManifest.xml':

under /android/app/src/main/AndroidManifest.xml replace your App Id here:

<!-- TODO: REPLACE WITH YOUR ADMOB APP ID -->
<!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
           android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" />


6. Replace the App Id for iOS in 'Info.plist':

under /ios/Runner/Info.plist replace your App Id here:

<key>GADApplicationIdentifier</key>
<string>ca-app-pub-################~##########</string>


7. Replace your Ad units in the app:

You will find the Unit Ids for both Android and iOS in all 3 environments under /lib/src/env/config/:

replace your add units here:

  // TODO: REPLACE WITH YOUR ANDROID INTERSTITIAL AD ID
  @override
  String get androidInterstitialAdId => 'ANDROID_INTERSTITIAL_AD';
 
  // TODO: REPLACE WITH YOUR IOS INTERSTITIAL AD ID
  @override
  String get iosInterstitialAdId => 'IOS_INTERSTITIAL_AD';
 
  // TODO: REPLACE WITH YOUR ANDROID REWARDED AD ID
  @override
  String get androidRewardedAdId => 'ANDROID_REWARDED_AD';
 
  // TODO: REPLACE WITH YOUR IOS REWARDED AD ID
  @override
  String get iosRewardedAdId => 'IOS_REWARDED_AD';


You can then run your app and verify that the test ads are displayed.