I am trying to ad facebook_audience_network banner ads in my multiple screens.
I am using following method to create banner ad in each flutter app screen. The issue i am facing is whichever screen(screens with banner ad implementation code) 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(() {});
}
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}
I am not getting what is the issue with this code. I have followed the documentation steps.
So can anyone suggest me a solution for this? I think this is a major issue.
Thanks.