Admob banner, how to show only on home

flutter admob
flutter firebase admob example
flutter admob support
flutter admob mediation
trying to create a platform view of unregistered type admob_flutter banner
add test device admob flutter
flutter ads in listview
implement ad in flutter

Im successfully showing the smart banner on footer and then dispose it. My problem is that is showing on all pages of the app.

My question is: How to show only on one page?

 void initState() {
   ..load().then((loaded) {
     if (loaded && this.mounted) {;


I found working solution from Github link here. The idea is quite simple.

  1. First you need an Ads helper class. You can follow the link or see below.
  2. Call showBannerAd inside initState() at the page that you want to show Ads.
  3. Call showBannerAd like the following snippet after you pushed a page. This will show Ads again after you return back from the pushed page.
Navigator.push(context, MaterialPageRoute(builder: (context) => EditPage())).then((value) {
  1. Call hideBannderAd inside initState() at the pushed page that you don't want to show Ads. Then you are done.

My Ads helper class

import 'package:firebase_admob/firebase_admob.dart';

const String testDevice = 'YOUR_DEVICE_ID';

class Ads {
  static BannerAd _bannerAd;

  static void initialize() {
    FirebaseAdMob.instance.initialize(appId: FirebaseAdMob.testAppId);

  static const MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
    testDevices: testDevice != null ? <String>[testDevice] : null,
    keywords: <String>['foo', 'bar'],
    contentUrl: '',
    childDirected: true,
    nonPersonalizedAds: true,

  static BannerAd _createBannerAd() {
    return BannerAd(
      adUnitId: BannerAd.testAdUnitId,
      size: AdSize.banner,
      targetingInfo: targetingInfo,
      listener: (MobileAdEvent event) {
        print("BannerAd event $event");

  static void showBannerAd() {
    if (_bannerAd == null) _bannerAd = _createBannerAd();
      ..load() 0.0, anchorType: AnchorType.bottom);

  static void hideBannerAd() async {
    await _bannerAd.dispose();
    _bannerAd = null;

Showing Admob Ads only in selected pages · Issue #25773 · flutter , There is no way to decide the pages that I want to display the add. T .com/​questions/50972863/admob-banner-how-to-show-only-on-home  Take 20% Off & Get Free Ship! Make Your Own Vinyl Banners Online Now.

If you have multiple widgets acting as individual screens you just include the part

@override void initState() { 
    myBanner ..load().then((loaded) { 
        if (loaded && this.mounted) { 

You probably need to dispose it:

  void dispose() {

Flutter Admob banner, how to show only on home, When you add a banner ad to your application with Admob you will notice that the ad appears on all pages. I've worked hard to solve this, and  Durable, fade-resistant vinyl. Display with metal grommets, stands or adhesives

I just encountered the same problem while adding Ads to my app. In my case, I was calling my method to show the banner ad in the didChangeDependencies function. This method can be called multiple times by the app and I discovered (in my app) that it is called when you push a new route to the Navigator that's why a call to show the banner is made as I move to other screens of my app. Maybe you have a similar implementation.

Admob banner, how to show only on home on admob, flutter, Im successfully showing the smart banner on footer and then dispose it. My problem is that is showing on all pages of the app. My question is:  Looking for banners sale? Search now! is the newest place to search, delivering top results from across the web.

Discouraged banner implementations - AdMob Help, The banner ad example below shows an ad sandwiched between different areas of the app content: the interactive app content and the custom app navigation/  This article shows you how to integrate banner ads from AdMob into an Android app. First create a new project in Android Studio and add the following codes to import the google Mobile Ads SDK. In the project-level build.gradle file, add the highlighted code to the allprojects section.

Banner Ads | Android, Garage video tutorials; Success stories. Home · Products · Google AdMob Banner ads occupy a spot within an app's layout, either at the top or bottom of This guide shows you how to integrate banner ads from AdMob into an Android app. onAdFailedToLoad(), The onAdFailedToLoad() method is the only one that  If your container has padding, that effectively decreases the size of your container. In the event that the container cannot fit the banner ad, the banner will not appear, and you will get this warning in the logs: W/Ads: Not enough space to show ad. Needs 320x50 dp, but only has 288x495 dp. The table below lists the standard banner sizes.

Adaptive Banners | Android, Improving on smart banners, which only supported fixed heights, adaptive banners let Set the ad size on the banner ad view—do this using AdView. NoSixFive, a gaming company based in Sofia, Bulgaria, built its game Jump Drive around the rewarded ad experience. The company was monetizing its existing apps with banner and interstitial ads, but wanted to try out rewarded ads. NoSixFive had originally chosen to work with AdMob because of the high fill rates and good user experience.

  • Thanks for your reply, but that's my question. The banner is showing on all pages once its initialized, even through that code is only on one page.
  • im navigating to other pages through '() => Navigator.push(context, new MaterialPageRoute(builder: (context) => new NewPage()'
  • When your new Screen is called within the Navigator you just include the Banner into the start of the specific screen. Please share a bit more code of one of your screens.
  • as i said the problem is simple. once the banner is initialized it will show on all screens regardless where is initialized. Well let me give you my code
  • It will show on all screens that are under the position in the widget tree of where you initialized that banner.