Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter - Facebook Audience Network Banner Ad Not loading, While Interestitial Ad Working fine #149

Open
fldvlpr opened this issue Mar 5, 2024 · 3 comments

Comments

@fldvlpr
Copy link

fldvlpr commented Mar 5, 2024

Hey Folks,

@dreamsoftin @SachinGanesh

Recently, I was working on one of my mobile app and was trying to add facebook audience network plugin, But there is one strange issue is happening with my mobile app. I'm able to fetch interestitial app for facebook ads while banner ads are not loading in debug and release both mode. Following is my code, I've also cross verified my placement id for banner and interestitial ads.

bool isBannerAdLoaded = false;
  Widget bannerAdWidget = const SizedBox();

  void loadBannerAd() {
    debugPrint('facebook loadBannerAd called');
    bannerAdWidget = FacebookBannerAd(
      placementId: FbAdManager.getBannerAdUnitID(),
      bannerSize: BannerSize.STANDARD,
      listener: (result, value) {
        debugPrint('facebook loadBannerAd listener : ${result.toString()}');
        switch (result) {
          case BannerAdResult.ERROR:
            isBannerAdLoaded = false;
            debugPrint('Error: $value');
            break;
          case BannerAdResult.LOADED:
            setState(() {
              isBannerAdLoaded = true;
            });

            debugPrint('Loaded: $value');
            break;
          case BannerAdResult.CLICKED:
            debugPrint('Clicked: $value');
            break;
          case BannerAdResult.LOGGING_IMPRESSION:
            debugPrint('Logging Impression: $value');
            break;
        }
      },
    );
  }

  @override
  void initState() {
    super.initState();

    loadBannerAd();
  }

  @override
  Widget build(BuildContext context) {
    return isBannerAdLoaded ? bannerAdWidget : const SizedBox();
  }

I'm not getting any errors or logs. I've implemented the facebook ads many times in past. But this kind of issue never happened.

Let me know if there is anything if I'm missing.

Thanks

@HussainTaj-W
Copy link

@fldvlpr were you able to solve this?

@nooralibutt
Copy link

@fldvlpr instead of placing it based on a flag, place FacebookBannerAd directly inside build method without if clause and wait for it to load and show.

@krrskl
Copy link

krrskl commented Aug 25, 2024

Your problem appears in release mode or debug using testIds?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants