dreamsoftin / facebook_audience_network

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

Application attempted to call on a destroyed WebView - Flutter Facebook Ads doesn't loaded when open another screen #58

Open MungaraJay opened 3 years ago

MungaraJay commented 3 years ago

I am trying to create banner ad in my 5-10 screens. I am using following method to create banner ad in each flutter app screen. So whichever screen i open for the first time it loads ad successfully. But, when i go to another screen then it doesn't load ads anyway. I have also implemented logic that ad requests are made throughout the app after 30 seconds. Still i am not able to load ads on other screens once loaded in first screen.

createBannerAd() {
    _currentAd = Container(
      alignment: Alignment(0.5, 1),
      child: FacebookBannerAd(
        placementId:  IMG_16_9_APP_INSTALL#2312433698835503_2964944860251047,
        bannerSize: BannerSize.STANDARD,
        listener: (result, value) {
          switch (result) {
            case BannerAdResult.ERROR:
              _adShown = false;
              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;
          }
        },
      ),
    );
    setState(() {});
  }

I am not getting what is the issue with this code. I have followed the proper documentation as well.

So can anyone suggest me a proper solution for this.

Thanks.

Error log :

D/EgretLoader(25084): EgretLoader(Context context) D/EgretLoader(25084): The context is not activity W/cr_AwContents(25084): Application attempted to call on a destroyed WebView W/cr_AwContents(25084): java.lang.Throwable W/cr_AwContents(25084): at org.chromium.android_webview.AwContents.a(PG:126) W/cr_AwContents(25084): at TA0.loadingStateChanged(PG:2) W/cr_AwContents(25084): at android.os.MessageQueue.nativePollOnce(Native Method) W/cr_AwContents(25084): at android.os.MessageQueue.next(MessageQueue.java:325) W/cr_AwContents(25084): at android.os.Looper.loop(Looper.java:148) W/cr_AwContents(25084): at android.app.ActivityThread.main(ActivityThread.java:6634) W/cr_AwContents(25084): at java.lang.reflect.Method.invoke(Native Method) W/cr_AwContents(25084): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) W/cr_AwContents(25084): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:822) I/flutter (25084): Error: {error_message: No Fill, error_code: 1001, invalidated: false, placement_id: IMG_16_9_APP_INSTALL#2312433698835503_2964944860251047}

github-kalpesh commented 3 years ago

I have also get same problem, ad not load please suggest any solution.

pav3lo commented 3 years ago

Same problem, Has anyone found how to fix it?

I/flutter (22319): Error: {error_code: 1001, error_message: No Fill, invalidated: false, placement_id: ... } W/cr_AwContents(22319): Application attempted to call on a destroyed WebView W/cr_AwContents(22319): java.lang.Throwable W/cr_AwContents(22319): at org.chromium.android_webview.AwContents.a(PG:127) W/cr_AwContents(22319): at qv0.loadingStateChanged(PG:2) W/cr_AwContents(22319): at android.os.MessageQueue.nativePollOnce(Native Method) W/cr_AwContents(22319): at android.os.MessageQueue.next(MessageQueue.java:323) W/cr_AwContents(22319): at android.os.Looper.loop(Looper.java:136) W/cr_AwContents(22319): at android.app.ActivityThread.main(ActivityThread.java:6682) W/cr_AwContents(22319): at java.lang.reflect.Method.invoke(Native Method) W/cr_AwContents(22319): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) W/cr_AwContents(22319): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

UsamaAyub80 commented 3 years ago

Same Issue With my intrestitial ad load corrckt in 1st screen but when i click on bottom nav another screen facebook ad can't initialize