How to integrate AdMob ads in a Flutter app

There are many ways to make money as a mobile developer, such as selling Flutter templates, freelancing, teaching, and monetizing your app through Admob ads, which is the topic of this article. We have completed the UI design of the Restaurant Flutter App before, and we improved its user experience by creating a shimmer loading effect.

In this article, we will learn how to integrate AdMob ads in this template. You can find the source code here to follow along with this tutorial.

So without further ado, let's cut to the chase and start writing some code!

Install the Flutter Google Ads package
To integrate google AdMob ads into our application we need the Flutter Google Ads package, which you can find here.

With your Flutter app open in your favorite IDE, run the following command in a terminal:

flutter pub add google_mobile_ads

Create the necessary folders and files

After installing the necessary files and classes, create a new folder called controllers in the lib folder.

Create a file called ad_manager.dart inside the controllers folder.

Create another folder called data and inside it create a file called ids.dart

implement advertising

Go to tag android->app->main>AndroidManifest.xml and add this inside meta-data tag application:

<meta-data
           android:name="com.google.android.gms.ads.APPLICATION_ID"
           android:value="ca

Guess you like

Origin blog.csdn.net/iCloudEnd/article/details/131699725
Recommended