Earn real money from Flutter Application by implement Facebook Ad

Hitesh Dhamshaniya
3 min readSep 20, 2020

--

In this post, we are going to learn how to earn real money from Flutter application by simply implementing Facebook ads (Facebook Audience Network)

In order to show Facebook ads into the flutter application, we need to implement the package which we get from https://pub.dev.

Follow the below step to add package into our application.

1. Depend on it

Add this to your package’s pubspec.yaml file:

dependencies:
facebook_audience_network: ^0.7.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:facebook_audience_network/facebook_audience_network.dart';

In this post, we are going to use testing project id and placement id to show various ads like (Banner ad and Interstitial ad), to get real project id we have to provide our application for review to Facebook, once they approve we get project id and after we can create placement id as per our requirement.

Let’s check how to implement it.

First of all, we need to initialize FacebookAudieceNetwork lib, init state is the best place to do so, so we will init.

Initialize the FacebookAudienceNetwork

The _loadInterstitialAd() is function to load interstitial ad, function contains code like below.

Facebook Audience Network load Interstitial ads

Generally, Interstitial ads show when user change activity, such that went from list to detail screen or when go back from detail screen to back. So we create a method which will check isInterstitial ad is loaded if so, then it will display the ad or we can request again to load an interstitial ad. Below method is used to show the interstitial ad.

Facebook Audience Network Show Interstitial Ad

Banner Ad

Facebook Audience Network Banner ad
Facebook Audience Network Banner Ad

Interstitial Ad

Facebook Audience Network Interstitial Ad

Here is a GitHub repo where one can find the whole implementation.

Please do let me know if you found any problem while integration, I will try my best to provide a solution.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Hitesh Dhamshaniya
Hitesh Dhamshaniya

Responses (1)

Write a response