dreamsoftin / facebook_audience_network

Flutter Facebook Audience Network
https://pub.dartlang.org/packages/facebook_audience_network/
MIT License
154 stars 93 forks source link

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

Open fldvlpr opened 4 months ago

fldvlpr commented 4 months ago

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 commented 1 month ago

@fldvlpr were you able to solve this?