Easy-to-make native ads in flutter using AdMOB SDK.

Overview

native_admob_flutter

Easy-to-make ads in Flutter with Google's AdMob SDK.
English | Português

Get started

To get started with Native Ads for Flutter, read the documentation

✔️ Native Ads (Android-only)
✔️ Banner Ads
✔️ Interstitial Ads
✔️ Rewarded Ads
✔️ App Open Ads
✔️ Rewarded Intersitital Ads

Supported platforms

AdMOB only supports ads on mobile. Web and desktop are out of reach

✔️ Android
✔️ iOS (Huge thanks to @clemortel)

Issues and feedback

Please file issues, bugs, or feature requests in our issue tracker.

To contribute a change to this plugin open a pull request.

Comments
  • Banner ad loads and disappear( triggers loadFailed event) and always shows real ads

    Banner ad loads and disappear( triggers loadFailed event) and always shows real ads

    Hi.

    I've been trying to implement this package, but im facing some weird behaviour.

    1st: Banner ads reloads every x time.

    This is the code i have:

    class SymbolsPage extends StatefulWidget {
      @override
      _SymbolsPageState createState() => _SymbolsPageState();
    }
    
    
    
    class _SymbolsPageState extends State<SymbolsPage> {
      final hc = Get.put(HomeController());
    
      final ac = Get.find<AdmobController>();
    
      final TextEditingController nameController = TextEditingController();
    
      Logger logger = Logger();
    
      final bannerController = BannerAdController();
    
    
      @override
      void initState() { 
        super.initState();
        bannerController.load();
    
         bannerController.onEvent.listen((e) {
          final event = e.keys.first;
          switch (event) {
            case BannerAdEvent.loading:
              logger.i('BannerAdEvent: loading');
              break;
            case BannerAdEvent.loaded:
              logger.i('BannerAdEvent: loaded');
              break;
            case BannerAdEvent.loadFailed:
              final errorCode = e.values.first;
              logger.i('BannerAdEvent: loadFailed $errorCode');
              break;
            case BannerAdEvent.impression:
              logger.i('BannerAdEvent: ad rendered');
              break;
            default:
              break;
          }
      });
        
      }
    
      @override
      void dispose() { 
        super.dispose();
        bannerController.dispose();
        
    
      }
    
      
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          backgroundColor: Colors.yellow[800],
          appBar: AppBar(
            title: Text('name'),
            backgroundColor: appThemeData.primaryColor,
          ),
          body: GetBuilder<HomeController>(
            builder: (_) => Column(
              children: [
                Container(
                  margin: EdgeInsets.only(top: 30, left: 18, right: 18),
                  child: CustomSearchText(
                    text: hc.nickName,
                    enable: true,
                    callback: () {
                      nameController.text = hc.nickName;
                      TextSelection.fromPosition(
                        TextPosition(offset: nameController.text.length),
                      );
                      // TODO: Fix bug when generating new nickname and does not change in textbox if focus is on
                    },
                    controller: nameController,
                    callback2: (text) {
                      TextSelection previousSelection = nameController.selection;
                 
                      nameController.selection = previousSelection;
                      logger.v("${nameController.selection.start}");
                      _.changeNickName(text);
                    },
                  ),
                ),
    
            
                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                
                    FlatButton.icon(
                      icon: Icon(Icons.copy_rounded),
                      label: Text('copy'.tr),
                      color: appThemeData.accentColor,
                      onPressed: () {
                        Clipboard.setData(ClipboardData(text: hc.nickName));
                        Get.snackbar("snackbar_download_title".tr,
                            "snackbar_download_message".tr,
                            snackPosition: SnackPosition.BOTTOM,
                            backgroundColor: appThemeData.accentColor);
                      },
                    )
                  ],
                ),
                const SizedBox(
                  height: 10,
                ),
              
                Expanded(
                  child: GridView.builder(
                      padding: EdgeInsets.only(left: 8, right: 8),
                      gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                        childAspectRatio: 3 / 2,
                        crossAxisSpacing: 20,
                        mainAxisSpacing: 20,
                        crossAxisCount: 4,
                      ),
                      itemCount: symbols2.length,
                      itemBuilder: (BuildContext ctx, index) {
                        return GestureDetector(
                          onTap: () {
                         
                            Get.snackbar("snackbar_download_title2".tr,
                                "snackbar_download_message".tr,
                                snackPosition: SnackPosition.BOTTOM,
                                backgroundColor: appThemeData.accentColor);
                            print("nameController.selection.start");
                            Clipboard.setData(
                                ClipboardData(text: symbols2[index].symbol));
                          },
                          child: Container(
                            alignment: Alignment.center,
                            child: Text(symbols2[index].symbol),
                            decoration: BoxDecoration(
                                color: appThemeData.accentColor,
                                borderRadius: BorderRadius.circular(15)),
                          ),
                        );
                      }),
                ),
    
                
                 BannerAd(controller: bannerController, size: BannerSize.ADAPTIVE),
              ],
            ),
          ),
          bottomNavigationBar: BottomBar(),
        );
      }
    }
    

    adchanges adchanges2

    2nd: Ads are loaded as production ads or test ads(like random), even though i hardcoded them or, in this case, i retrieve them from my "MyAdmob.class" or wether i place them in the initialize method or straight in the widget's parameter the result is the same.

    void main() async{
      WidgetsFlutterBinding.ensureInitialized();
      await MobileAds.initialize(
        bannerAdUnitId: MyAdmob.getBannerAdId(),
        interstitialAdUnitId: MyAdmob.getInterstitialAdId(),
        appOpenAdUnitId: MyAdmob.getOpenAdId(),
        
      );
      Get.put(AdmobController());
      // FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
      // Admob.requestTrackingAuthorization();
      runApp(MyApp());
    }
    
    class MyApp extends StatelessWidget {
      // This widget is the root of your application.
      // Locale myLocale;
    
      @override
      Widget build(BuildContext context) {
        return GetMaterialApp(
          title: 'names',
          debugShowCheckedModeBanner: false,
          theme: appThemeData,
          translations: MyTransalations(),
          locale: Get.deviceLocale,
          home: SplashPage(),
          // locale: Get.deviceLocale,
          // translations: MyTransalations(),
        );
      }
    }
    
    invalid Banner Ad 
    opened by Blast06 27
  • Possible memory leak - some users report crashing and device rebooting with banner ads

    Possible memory leak - some users report crashing and device rebooting with banner ads

    This plugin seems to suffer from the same issue as admob_flutter. A growing number of my users are reporting consistent crashing and even device rebooting after loading banner ads. Sorry I can't provide more feedback, as I haven't been able to reporduce it on any of my devices, but I've noticed it happens mostly on Samsung devices, if that's any help...

    bug 
    opened by gkovac42 26
  • 1.0.0-pre iOS BannerAds keep floating on top or at bottom when added into ListView while scrolling

    1.0.0-pre iOS BannerAds keep floating on top or at bottom when added into ListView while scrolling

    I just encountered that on iOS the BannerAd, embedded in a ListView, would stay on top, or at the bottom when scrolled away from the view.

        ListView(
          children: [SomeWidget(), BannerAd(), SomeWidget(), SomeWidget(), BannerAd(), SomeWidget()]
        )
    

    image

    iOS Native Ad Banner Ad 
    opened by ad-on-is 19
  • Ads after refresh or few time later went black

    Ads after refresh or few time later went black

    Hey, thanks for the plugin.

    I have followed this- https://github.com/bdlukaa/native_admob_flutter/wiki/Creating-a-native-ad#creating-a-layout-builder

    but either after a referesh or few time later on, I see the black background.

    Edit:- Similar to this - https://github.com/duyduong/flutter_native_admob/pull/74 (may be)

    Native Ad Banner Ad 
    opened by ycv005 19
  • App Open not working

    App Open not working

    App open ad is not working with test and real id. The error shows App open ad Timeout.

    I tried with the example code in the repo, but facing the same problem.

    invalid 
    opened by sumitgohil 13
  • [Question] Native ads guidelines (AdChoices or Ads by Google Icon)

    [Question] Native ads guidelines (AdChoices or Ads by Google Icon)

    Hi, according to Google AdMob Native ads policies & guidelines, it is required to display 'Ad Attribution' and 'AdChoices icon (or Ads by Google, where applicable)'. In the Screenshots of the ads, the 'Ads by Google' is showing on the top right corner, but I am not able to find this 'AdChoices' attribute in the example code.

    May I know is the 'AdChoices icon (or Ads by Google)' required when implementing native ads? If yes, how do I enable it?

    Thanks.

    opened by EternalYouth29 10
  • Question: Is there any method to stop ad reloads when calling setState() ?

    Question: Is there any method to stop ad reloads when calling setState() ?

    I noticed the ads are being reloaded after calling setState() in the app. However I wanted to stop this behavior since I have to call setState several times in the widget containing the ads, which causes them to reload.

    invalid Native Ad 
    opened by ramtinq 10
  • Does the package support mediation?

    Does the package support mediation?

    If yes, can you please give me the steps on adapters' implementation and everything I need to get mediation ready and running. If no, I will still use the package bcz it is the best on pub as of now. Thank you.

    enhancement good first issue 
    opened by anass-naoushi 9
  • 1.0.0-pre BannerAds not showing on iOS with real adUnitIDs

    1.0.0-pre BannerAds not showing on iOS with real adUnitIDs

    While BannerAds are shown when using test unit ids, they are not shown when using real ad units.

    iOS Admob status: ["GADMobileAds": <GADAdapterStatus: 0x280717ed0; state = Ready>]
    <Google> Invalid Request. Too many recently failed requests for ad unit ID: ca-app-pub-XXX/YYY. You must wait a few seconds before making another ad request.
    
    opened by ad-on-is 8
  • Real ads not showing but test ads are

    Real ads not showing but test ads are

    Real ads shows on emulator but doesnt shows on the real device. Why so ? Actually, real devices show test ads, but real ad doesnt seems to be showing.

    invalid Waiting for customer response 
    opened by sushilbalami 8
  • Native ad loading hangs with a NullPointerException

    Native ad loading hangs with a NullPointerException

    Sometimes when loading native ad, it keeps loading while showing the following error message in the console:

    W/Ads     (12456): NullPointerException occurs when invoking a method from a delegating listener.
    W/Ads     (12456): java.lang.NullPointerException: Attempt to invoke virtual method 'android.net.Uri com.google.android.gms.ads.nativead.NativeAd$Image.getUri()' on a null object reference
    W/Ads     (12456): 	at com.bruno.native_admob_flutter.native.NativeAdmobController$loadAd$2.onAdLoaded(Controller.kt:139)
    W/Ads     (12456): 	at com.google.android.gms.internal.ads.zzvj.onAdLoaded(com.google.android.gms:play-services-ads-lite@@19.8.0:12)
    W/Ads     (12456): 	at com.google.android.gms.internal.ads.zzxb.zza(com.google.android.gms:play-services-ads-lite@@19.8.0:11)
    W/Ads     (12456): 	at com.google.android.gms.internal.ads.zzgy.onTransact(com.google.android.gms:play-services-ads-base@@19.8.0:13)
    W/Ads     (12456): 	at android.os.Binder.transact(Binder.java:949)
    W/Ads     (12456): 	at gc.bb(:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:2)
    W/Ads     (12456): 	at com.google.android.gms.ads.internal.client.al.f(:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:0)
    W/Ads     (12456): 	at com.google.android.gms.ads.nonagon.shim.t.a(Unknown Source:0)
    W/Ads     (12456): 	at com.google.android.gms.ads.nonagon.slot.common.q.a(:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:2)
    W/Ads     (12456): 	at com.google.android.gms.ads.nonagon.shim.x.bj(:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:0)
    W/Ads     (12456): 	at com.google.android.gms.ads.nonagon.shim.loaders.e.run(Unknown Source:0)
    W/Ads     (12456): 	at android.os.Handler.handleCallback(Handler.java:883)
    W/Ads     (12456): 	at android.os.Handler.dispatchMessage(Handler.java:100)
    W/Ads     (12456): 	at qy.a(:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:0)
    W/Ads     (12456): 	at com.google.android.gms.ads.internal.util.f.a(:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:1)
    W/Ads     (12456): 	at qy.dispatchMessage(:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:0)
    W/Ads     (12456): 	at android.os.Looper.loop(Looper.java:237)
    W/Ads     (12456): 	at android.app.ActivityThread.main(ActivityThread.java:8167)
    W/Ads     (12456): 	at java.lang.reflect.Method.invoke(Native Method)
    W/Ads     (12456): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
    W/Ads     (12456): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
    
    bug Native Ad 
    opened by shimaatech 7
  • Cannot find 'kGADAdSizeBanner' in scope

    Cannot find 'kGADAdSizeBanner' in scope

    Since https://github.com/bdlukaa/native_admob_flutter/issues/133 was closed but not deployed I'm asking for this again in a different issue. Please @bdlukaa deploy a new version and close this issue. There are some people facing this problem and getting the package from master branch is not the best option. Thanks

    opened by erperejildo 0
  • Initializing failed

    Initializing failed

    My banner ads can be successfully displayed, but when I use this package to display native ads, it says my mobile sdk has not been initialized. I have already called await MobileAds.instance.initialize(); in the main method, and the banner ads can be loaded, how come my sdk has not been initialized?

    The following is the error returned

    E/flutter ( 5851): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: 'package:native_admob_flutter/src/utils.dart': Failed assertion: line 30 pos 5: 'MobileAds.isInitialized': The Mobile Ads SDK must be initialized before any ads can be loaded package:native_admob_flutter/src/utils.dart:30 E/flutter ( 5851): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)

    opened by wmla419 0
  • Issue: Violation of Families Policy Requirements

    Issue: Violation of Families Policy Requirements

    I recently got rid of the official google ads package tired of it performance. Today I pushed a new version on Android and got this message:

    After a recent review, we’ve found an issue with your app. See below for more information about your app’s status and how to correct the issue.
    
    Publishing status: Rejected
    
    Your app has been rejected and wasn't published due to a policy violation. If you submitted an update, the previous version of your app is still available on Google Play.
    
    Issue: Violation of Families Policy Requirements
    
    We have detected that your app includes non-certified ad SDKs or SDKs that are not approved for use in child-directed services. Any SDKs used in the app must be appropriate for use in child-directed services. Additionally, apps that solely target children must not contain any SDKs that are not approved for use in child-directed services, including ads SDKs. Apps in the Designed for Families program must only use ad SDKs that have certified their compliance with the [Families Ads Program](https://notifications.google.com/g/p/AD-FnExfsVLzg5Hp7_EVUJSTijltAYLByN4ZrYk55APskquUKCrZh3x-Rpb_NZg_QITxWxCP5KfSWcQkcoWuFkRbeX2C6-X9d8M1BnFsSeR2J7s9kFHeCDtr62nl4ni4GCe6Tn3j2LO9mKH7). 
    
    Next steps: Submit your updated app for another review
    
    Review the [Families Policy Requirements](https://notifications.google.com/g/p/AD-FnEyKJCliqdr4oRgmn3Jsqh3SZmlhzZPwk_sPiJgjCNb2WLxIEYIEHdMjcWAbYFER8D4gnQZsNQQwPq8Srf0G6E7WIaejDpQhjUspGbv2bXSoEH_08Gy9Wxtp03fD3g4E3tZ8PM39EiPqxT7s6GZEZgQXBtsJDUooFtqemgyZ9y2j), [Designed for Families Requirements](https://notifications.google.com/g/p/AD-FnEyh8GxRZAOxO1IAa6SrPiE-vo5BZfS4EB9_OYrsrwRJnrZroe3Q8jn6sQeZ2x6RFbHMgnO7uAFhtil-S1v2ml-NN5M9r-hpLaYPXLqrxHk6tfh_kx3yOouvpedAmRd433j5rNU5lcZo9DMyvL402zgei-yYeA), and [Ads and Monetization](https://notifications.google.com/g/p/AD-FnEzGiEMbY3n8Oij0q3KDd3Kk_Uj9r5VSEdOOkc9fgM_IE8hoCpJTTNz8BV294fkSx4pMbDREUXMuTZ8ksWgG1rBtACsG-7QFkkdjcvixMChnnryEIGEtht7x) policy for more information.
    Make appropriate changes to your app, and be sure to remove any non-certified ad SDKs or SDKs that are not approved for use in child-directed services. Remember, apps in the Designed for Families program that use ad SDKs for serving ads must only use ad SDKs that have certified their compliance with the [Families Ads Program](https://notifications.google.com/g/p/AD-FnExfsVLzg5Hp7_EVUJSTijltAYLByN4ZrYk55APskquUKCrZh3x-Rpb_NZg_QITxWxCP5KfSWcQkcoWuFkRbeX2C6-X9d8M1BnFsSeR2J7s9kFHeCDtr62nl4ni4GCe6Tn3j2LO9mKH7). Additionally, all other SDKs used in your app must be appropriate to be used in child-directed services.
    Before submitting your app, make sure that your app is compliant with all other [Developer Program Policies](https://notifications.google.com/g/p/AD-FnEwRaFBhz3gpqrRMU_FEaOPATZWmpXcS3VMmGkb54m-A8yeF8KkdT4Hyl-2r_by3KU8y6cbT5cMkX1yH1UtV2Nn29DyRLeMFLCjBngykg8BEnlNognuX2cV9).
    Select Store presence > Store listing, and click Resubmit app.
    Contact support 
    
    If you’ve reviewed the policy and believe our decision may have been in error, please reach out to our [policy support team](https://notifications.google.com/g/p/AD-FnExnKHaey4KqFsJ52oOaEhYWBcRD2cKM71CDZxa3NaZFmqK-hARAUc8gU1IQ5NO3IqW57RQwoMuXVX_CF1z2DJgn_GHS4o6DU5QKIJf4lenzA4keVWrquvmSo7pe41ywN3D8-XidCu2fE3swZZi2oTW7ixYZNuxRoucHspGVGlaTtqtNwk8TCHKjUR4Y1TE2PsJhc9HiyN2QRXsAPXd8siShlKhT2xQfLqiuK6j942GTM5I06b2uNJ_oi6leoUVvIJXLVfXP1VU_Q0Fmv5ECEtLmSWw5bMdHGrrShJ1PybpqW-o). We’ll get back to you within 2 business days.
    

    How can I fix this? I don't really want to go back to previous package

    opened by erperejildo 3
  • Adaptive banner not getting size properly

    Adaptive banner not getting size properly

    return SafeArea(
                child: Stack(
                  children: [
                    Column(
                      children: <Widget>[
                        Provider.of<AdState>(context).initialized
                            ?
                            Container(
                                color: Theme.of(context).primaryColor,
                                width: double.infinity,
                                height: 150, // just to test it
                                child: BannerAd(
                                  builder: (context, child) {
                                    return child;
                                  },
                                  size: BannerSize.ADAPTIVE,
                                ),
                              )
                            : Container(),
                        Expanded(child: child!),
                      ],
                    ),
                  ],
                ),
              );
    

    Simulator Screen Shot - iPhone 13 - 2022-01-30 at 13 03 00

    Shouldn't it cover more of the blue and/or the black area?

    opened by erperejildo 2
  • Native Ads are not working anymore

    Native Ads are not working anymore

    Native ads seems to be failed in loading for now. Sometimes, it can only load one native ads only.

    How to reproduce? Screenshot_2022-01-16-08-53-34-996_com example native_admob_flutter_example

    1 - Run the example 2 - You will see loading texts only in native ads section 3 - Make a pull to refresh and seems to be that only one native ads is displaying.

    opened by thetnswe 0
Owner
Bruno D'Luka
have fun, no one lasts forever
Bruno D'Luka
Admob Flutter plugin that shows banner ads using native platform views.

Looking for Maintainers. Unfortunately I haven't been able to keep up with demand for features and improvments. If you are interested in helping maint

Kevin McGill 418 Dec 3, 2022
Google mobile ads applovin - AppLovin mediation plugin for Google Mobile Ads (Flutter).

AppLovin mediation plugin for Google Mobile Ads Flutter Google Mobile Ads Flutter mediation plugin for AppLovin. Use this package as a library depende

Taeho Kim 1 Jul 5, 2022
Plugin to integrate native firebase admob to Flutter application

flutter_native_admob Plugin to integrate Firebase Native Admob to Flutter application Platform supported: iOS, Android Getting Started For help gettin

Duy Duong 63 Dec 21, 2022
An easy way to add all google ads to your flutter app.

Google Ads An easy way to add all google ads to your flutter app. How to use it Add the google_mobile_ads package using flutter pub add google_mobile_

Yemeni Open Source 4 Sep 27, 2022
Flutter plugin for Firebase Auth UI. Supports popular auth providers by using native SDK for Android and iOS.

firebase_auth_ui Flutter plugin of Firebase UI which allows to add login/sign-up quickly. NOTE: This plugin is under development. Please provide Feedb

Sandip Fichadiya 50 Mar 23, 2022
A Flutter package to make your text selectable for web and non-selectable for native builds.

PlatformText A Flutter package to make your text selectable for web and non-selectable for native builds. Features PlatformText returns Text or Select

Piotr Rozpończyk 1 Jun 9, 2022
Learn to make beautiful, native apps for Android & iOS

name title subtitle description speaker flutter Flutter Learn to make beautiful, native apps for Android & iOS Flutter is a cross-platform, mobile dev

Akshath Jain 5 Nov 4, 2019
how to Integrating facebook audience network to flutter app for banner, interstitial, rewarded, native and native banner

fb_ads_flutter_12 A new Flutter project. Getting Started Watch the complite tutorial for integrating Facebook ads into the Flutter app in our Youtube

null 4 Nov 26, 2022
react-native native module for In App Purchase.

Documentation Published in website. Announcement Version 8.0.0 is currently in release candidate. The module is completely rewritten with Kotlin and S

dooboolab 2.3k Dec 31, 2022
dna, dart native access. A lightweight dart to native super channel plugin

dna, dart native access. A lightweight dart to native super channel plugin, You can use it to invoke any native code directly in contextual and chained dart code.

Assuner 14 Jul 11, 2022
A Flutter App To Watch Anime Online With No Ads

Tako Play A Mobile App to Watch Anime With No ADS !! . Please Do not put Tako-Pl

Kaung Satt Hein 133 Dec 22, 2022
The lightweight and powerful wrapper library for Twitter Ads API written in Dart and Flutter 🐦

TODO: Put a short description of the package here that helps potential users know whether this package might be useful for them. Features TODO: List w

Twitter.dart 2 Aug 26, 2022
Mangato - An Android & IOS app to read manga on your phone without ads.

Mangato Read your favorite Japanese manga on Mangato including Attack on Titan, Fairy Tail, The Seven Deadly Sins, Fuuka, One Piece, and more. WARNING

Marouane 20 Nov 21, 2022
PsTube - Watch and download videos without ads

PsTube - Formerly FluTube Watch and download videos without ads Features Beautiful user interface Lightweight and fast No Login Required Keep your lik

Prateek Sunal 249 Dec 21, 2022
RoomKit Flutter is a wrapper of Native Android and iOS RoomKit SDK

ZEGOCLOUD RoomKit Flutter RoomKit Flutter is a wrapper of Native Android and iOS RoomKit SDK Getting started Prerequisites Basic requirements Android

null 0 Dec 16, 2022
A native Dart SDK for Stripe.

stripe_fl stripe A native Dart SDK for Stripe. Documentation Initializing import 'package:stripe_fl/stripe_fl.dart'; Stripe.init( produc

Chiziaruhoma Ogbonda 3 May 15, 2020
Woocommerce SDK for Flutter. The Complete Woo Commerce SDK for Flutter.

woocommerce Woocommerce SDK for Flutter. Getting Started Add the package to your pubspec.yaml and import. import 'package:woocommerce/woocommerce.dart

RAY 105 Dec 6, 2022
Hyakunin Isshu 1 Jan 11, 2022