Skip to content

Admob setup

Admob is a popular advertising platform that allows you to monetize your app by displaying ads. This guide will show you how to set up Admob in your flutter app.

Setup

  1. Go to the Admob website and sign up for an account.

  2. Create a new project and name it.

  3. Click on the app that you created, then click on Ad Units section. Click on Add Ad Unit and select the type of ad unit you want to create.

Admob Ad Unit Setup

  1. You need to create 4 different ad units. One for each type of ad: Banner, Interstitial, Rewarded, and Rewarded Interstitial.

  2. Click on the ad unit you created and copy the Ad Unit ID. Paste it in your .env file under these keys:

    a. ANDROID_BANNER_AD_UNIT_ID b. ANDROID_INTERSTITIAL_AD_UNIT_ID c. ANDROID_REWARDED_AD_UNIT_ID d. ANDROID_REWARDED_INTERSTITIAL_AD_UNIT_ID

  3. Copy the App ID from the Admob dashboard and paste it in your AndroidManifest.xml file under the <meta-data> tag.

xml
<meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="YOUR_ADMOB_APP_ID"/>

Also, add the app id to your .env file under the key ANDROID_ADMOB_APP_ID. If you also have an iOS app, you need to add the app id to the Info.plist file and in the .env file under the key IOS_ADMOB_APP_ID.

Admob App ID Setup