'Too many recently failed requests for ad unit ID (AdMob)
Too many recently failed requests for ad unit ID: ca-app-pub-XXXX. You must wait a few seconds before making another ad request.
I erased all contents of simulator and restarted it, but it didn't work at all. I guess it might be happened because of previous failed requests, I have no idea how to solve it. I just waited a minutes, but ad didn't show up. Also I don't understand what you must wait a few seconds before making another ad request
means. Has anyone solved this?
import 'package:admob_flutter/admob_flutter.dart';
class _HomeState extends State<Home> {
AdmobBannerSize bannerSize;
AdmobInterstitial interstitialAd;
@override
void initState() {
super.initState();
Admob.initialize(Platform.isIOS
? 'ca-app-pub-XXXXXXXXXXXXXXXXXXXXXXXXX'
: 'ca-app-pub-XXXXXXXXXXXXXXXXXXXXXXXXX');
interstitialAd = AdmobInterstitial(
adUnitId: Platform.isIOS
? 'ca-app-pub-XXXXXXXXXXXXXXXXXXXXXXXXX'
: 'ca-app-pub-XXXXXXXXXXXXXXXXXXXXXXXXX',
listener: (AdmobAdEvent event, Map<String, dynamic> args) {
print('$event');
if (event == AdmobAdEvent.closed) {
interstitialAd.load();
}
},
);
interstitialAd.load();
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomPadding: false,
resizeToAvoidBottomInset: true,
body: ListView(children: <Widget>[
Container(
width: MediaQuery.of(context).size.width - 50.0,
height: 50,
margin: EdgeInsets.only(left: 25, right: 25, top: 5),
decoration: BoxDecoration(
color: Color(0xFF337B6D),
borderRadius: BorderRadius.circular(25)),
child: AdmobBanner(
adUnitId: Platform.isIOS
? 'ca-app-pub-XXXXXXXXXXXXXXXXXXXXXXXXX'
: 'ca-app-pub-XXXXXXXXXXXXXXXXXXXXXXXXX',
adSize: AdmobBannerSize.BANNER,
listener: (AdmobAdEvent event, Map<String, dynamic> args) {
print('$event');
},
)
)
]
)
}
Solution 1:[1]
The code you've shared doesn't have any obvious issues. The error thrown from AdMob seems to come from the traffic of requests. You can also check if the Ad is being loaded multiple times using the AdListener.onAdLoaded()
callback. This is a known issue as mentioned in this thread.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Omatt |