ezaldeen alayed
ezaldeen alayed

Reputation: 15

BannerAd event is MobileAdEvent.failedToLoad

W/flutter (29884): onAdFailedToLoad: 3
I/Ads     (29884): Ad failed to load : 3
I/flutter (29884): BannerAd event is MobileAdEvent.failedToLoad

I made a firebase account and I connect to a flutter app, but something goes wrong. Can you help me?

Upvotes: 0

Views: 1490

Answers (1)

olyjosh
olyjosh

Reputation: 441

Looks like you are making common mistake with the Ad Unit ID. Check that you are not using thesame APP ID as AD UNIT ID

AD UNIT ID looks like ca-app-pub-504515xxxxxxxxx/xxxxxxxxx (what you should use for ad unit), while APP ID looks like ca-app-pub-504515xxxxxxxxx~xxxxxxxxx - It's for the App ID and not for AD UNIT ID. you need the one separated by /

Solution Code:

BannerAd myBanner = BannerAd(
  // Replace the testAdUnitId with an ad unit id from the AdMob dash.
  // https://developers.google.com/admob/android/test-ads
  // https://developers.google.com/admob/ios/test-ads
  //  adUnitId: BannerAd.testAdUnitId,
  adUnitId: "ca-app-pub-504515xxxxxxxxx/xxxxxxxxx", // look out for this
  size: AdSize.smartBanner,
  targetingInfo: targetingInfo,
  listener: (MobileAdEvent event) {
    print("BannerAd event is $event");
  },
);

Upvotes: 2

Related Questions