question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Limited Ad serving warning

See original GitHub issue
code snippet
import 'dart:async';
import 'dart:io';

import 'package:dotted_decoration/dotted_decoration.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class BannersAd extends StatefulWidget {
  const BannersAd({Key? key}) : super(key: key);

  @override
  _BannersAdState createState() => _BannersAdState();
}

class _BannersAdState extends State<BannersAd> {
  BannerAd? banner;
  bool loaded = false;

  String bannerAdUnitIdHome = Platform.isAndroid
      ? "******"
      :  "******"
 


  @override
  void initState() {
    WidgetsBinding.instance!.addPostFrameCallback((_) {

      initBanner();
 
    });

    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  initBanner() {

    banner = BannerAd(
      adUnitId: bannerAdUnitIdHome,
      size: AdSize.mediumRectangle,
      request: AdRequest(),
      listener: BannerAdListener(
        // Called when an ad is successfully received.
        onAdLoaded: (Ad ad) {
          print('banner loaded');
          loaded = true;
          setState(() {});
        },
        // Called when an ad request failed.
        onAdFailedToLoad: (Ad ad, LoadAdError error) {
          // Dispose the ad here to free resources.
          ad.dispose();
          print('Ad failed to load: $error');

          Future.delayed(Duration(seconds: 1), () {
            initBanner();
          });
        },
        // Called when an ad opens an overlay that covers the screen.
        onAdOpened: (Ad ad) => print('Ad opened.'),
        // Called when an ad removes an overlay that covers the screen.
        onAdClosed: (Ad ad) => print('Ad closed.'),
        // Called when an impression occurs on the ad.
        onAdImpression: (Ad ad) => print('Ad impression.'),
      ),
    );
    banner!.load();
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        SizedBox(
          height: 10,
        ),
        
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Expanded(
              child: Container(
                margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
                decoration: DottedDecoration(
                  color: Colors.white,
                  strokeWidth: 1,
                  shape: Shape.line,
                  linePosition: LinePosition.top,
                ),
              ),
            ),
            Text(
              "AD",
              style: TextStyle(color: Colors.white),
            ),
            Expanded(
              child: Container(
                margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
                decoration: DottedDecoration(
                  color: Colors.white,
                  strokeWidth: 1,
                  shape: Shape.line,
                  linePosition: LinePosition.top,
                ),
              ),
            ),
          ],
        ),
        SizedBox(
          height: 10,
        ),

   
        (banner == null)?
        GestureDetector(
          onTap: () async {
            // My web site
            const url = 'https://www.myweb.com';
            if (await canLaunch(url)) {
              await launch(url);
            } else {
              throw 'Could not launch $url';
            }
          },
          child: Container(
            height: 450.r,
            width: 500.r,
            decoration: BoxDecoration(
                color: Color(0xff3399FF),
                borderRadius: BorderRadius.all(Radius.circular(10)),
                image: DecorationImage(
                  image: AssetImage('assets/image/ad.jpg'),
                )),
          ),
        ):Container(
            width: 500.w,
            height: 450.h,
            alignment: Alignment.center,
            child: AdWidget(ad: banner!)) ,
        SizedBox(
          height: 10,
        ),

      ],
    );
  }
}

I got limit from admob image It says I : Ads are modified: Publishers may not change the behavior of Google ads in any way. These include resetting the size of the ad frame to be part of the ad or hiding the “Advertising Words Provided by Google”.

this is how it looks like:

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
ayoub-icommented, Oct 15, 2021

hi,

TLDR : remove native ad units, there is something wrong with them in the implementation.

Details:

i had exactly the same problem, after doing many tests i think i found the issue, it’s the native ads, there is definitely something wrong with the native ads implementation with this package, that makes google think you’re doing something wrong or trying to do ad fraud even if you do all best practices.

Here is what worked for me, remove all ad units from Admob and from your app, wait for a week or so for the ad serving limit to be lifted, then create your ad units back and put back ads into your app BUT DO NOT USE NATIVE ADS, i figured this out the hard way, when i put back the ads (interstitial + native) i get the ad serving limited, when i removed native and ONLY put back interstitials, it’s working fine for me so far.

(NB : i’m implementing all best practices as well, and traffic is organic).

1reaction
aananttcommented, Sep 11, 2021

@sunjianan9900 are you still facing this issue ?? or have you solved it ??

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ad serving limits - Google AdMob Help
Ad serving on your account is currently being limited due to invalid traffic concerns. We'll automatically review and update this limit as we...
Read more >
AdSense Ad Serving Has Been Limited: What You Can Do
Seeing the warning that ad serving has been limited in your AdSense account is a concern and can be costly to a publisher....
Read more >
Admob : Ad serving is limited - The number of ads you can ...
Admob : Ad serving is limited - The number of ads you can show has been limited. For details, go to the Policy...
Read more >
ADSENSE AD SERVING HAS BEEN LIMITED INVALID ...
REASONS YOU MIGHT BE GETTING THE AD SERVING HAS BEEN LIMITED INVALID TRAFFIC CONCERNS WARNING · 1. Accidental Clicks - If you use...
Read more >
Should I create new AdMob account? I am getting 'Ad serving ...
Google may sometimes place a limit on the number of ads your AdMob account can show. This might be a temporary ad serving...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found