Use the following link for detailed guide.
-
Create firebase project and enable analytics
-
Create Android Project with your package name and nickname like (hackbot android). Download google-services.json file and Move it into the android/app director
- Optional Step: For sha1 creation: Use this tool
keytool -list -v -alias key -keystore /Users/nooralibutt/development/FlutterWorkspace/hackbot/key123456.jks
- Optional Step: For sha1 creation: Use this tool
-
In the root-level (project-level) Gradle file (
android/build.gradle
), add rules to include the Google Services Gradle plugin. Check that you have Google's Maven repository.buildscript { repositories { // Check that you have the following line (if not, add it): google() // Google's Maven repository } ... dependencies { ... // TODO: Add Google Services plugin classpath 'com.google.gms:google-services:4.3.3' } } allprojects { ... repositories { // Check that you have the following line (if not, add it): google() // Google's Maven repository ... } }
-
In the module (app-level) Gradle file (
android/app/build.gradle
), apply the Google Services Gradle plugin.... // TODO: Apply google-services plugin apply plugin: 'com.google.gms.google-services' android { ... } ...
-
Enable Multidex in Android Open
project/app/build.gradle
and check ifminSdkVersion
isminSdkVersion 21
otherwisedefaultConfig { ... multiDexEnabled true } dependencies { ... implementation 'androidx.multidex:multidex:2.0.1' }
-
In iOS, In Xcode, drag the
GoogleService-Info.plist
file into the Runner directory, to import the configuration file into the Xcode project.
-
Use this link for test IDs of Admob
-
For Facebook Test IDs append
IMG_16_9_APP_INSTALL#
to test id and you will get a test ad. Remember to remove this befor publishing app. -
Add the Firebase AdMob Flutter plugin
-
Add the Facebook Audience Network plugin
-
Update
AndroidManifest.xml
(Android)-
Open the
android/app/src/main/AndroidManifest.xml
file in Android Studio. -
Add your AdMob app ID by adding a
<meta-data>
tag and enteringcom.google.android.gms.ads.APPLICATION_ID
. If your AdMob app ID isca-app-pub-3940256099942544~3347511713
, then you need to add the following lines to the AndroidManifest.xml file.android/app/src/main/AndroidManifest.xml
<manifest> ... <application> ... <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-your~id"/> </application> </manifest>
-
-
Update Info.plist (iOS)
-
Open the
ios/Runner/Info.plist
file in Android Studio. Add aGADApplicationIdentifier
key with the string value of your AdMob app ID. For example, if your AdMob app ID isca-app-pub-3940256099942544~1458002511
, then you need to add the following lines to the Info.plist file.ios/Runner/Info.plist
... <key>GADApplicationIdentifier</key> <string>ca-app-pub-your~id</string> ...
-
- Copy this code in your first screen like this
import 'package:firebase_core/firebase_core.dart'; _initializeEveryThing() async { await Future.wait([ AdManager.initAdManager(), Firebase.initializeApp(), ]); }
NOTE: IN iOS, Banner, Interstital and Native Ads are supported NOTE: In Pod file, set the minimum IOS deployment target version to 9.0