dreamsoftin / facebook_audience_network

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

Unable to refresh Banner Ad #28

Closed JohnBaker123 closed 4 years ago

JohnBaker123 commented 4 years ago

How to refresh Banner ads? I am trying to just set previous instance of FacebookBannerAd to null create a new instance of FacebookBannerAd since it looks like the banner doesn't get refreshed on there own. But none of the listener events are getting triggered on the 2nd instance so I am not seeing it loading.

FacebookBannerAd( placementId: "YOUR_PLACEMENT_ID", bannerSize: BannerSize.STANDARD, listener: (result, value) { switch (result) { case BannerAdResult.ERROR: print("Error: $value"); break; case BannerAdResult.LOADED: print("Loaded: $value"); break; case BannerAdResult.CLICKED: print("Clicked: $value"); break; case BannerAdResult.LOGGING_IMPRESSION: print("Logging Impression: $value"); break; } }, ),

JohnBaker123 commented 4 years ago

Ignore this. I seems to work now.

In my loaded listener if I put a few delays in there it seems to reload correctly. So I clear the banner for 1 second and then display the new instance.

                } else if (result == BannerAdResult.LOADED) {
                  setState(() {
                    _showBannerAd = true;
                  });
                  await new Future.delayed(const Duration(seconds: 90));
                  setState(() {
                    fb_banner_ad = null;
                  });
                  await new Future.delayed(const Duration(seconds: 1));
                  createFacebookBanner();
bettkipronoh commented 3 years ago

@JohnBaker123 how did you handle this? Am facing the same issue