-
Notifications
You must be signed in to change notification settings - Fork 287
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
The ad can not be shown when app is not in foreground (Android-iOS interstitial ad show issue) #1196
Comments
no, my issue is only app open ad, and only in android updateproviding updates in this issue, after 1 year, still counting ~1k 1 month in crashlytics as this issue flutter/flutter#151516, |
Have you installed firebase analytics or similar technologies to your app for verify nobody in your app experience this issue? Because it is not happening my device I am seeing the ads but according to logs some device can't see the ads. These data aggregated from nearly 50k devices both Android and iOS. It may currently happening your app too. Also this issue is same for all fullscreen ads (open ad, interstitial |
yes, my side crash log all errors (not only ad; but skip network error which my app may retry), i see no count in interstitial ad showe error you may have bug that there is 2 types of resume, 1 is flutter resume i may provide that later updateupdated which type of resume show which type ad flutter resume, show interstitial ad
admob resume, show app open ad
|
Hi @aykutuludag, we just released Can you confirm the errors you are seeing are happening for users that are running version |
Yes I can confirm I'm still getting error app is already integrated v5.2.0. Thanks to WidgetsBinding.instance.addPostFrameCallback and adding await before fullPageAd!.show, errors reduced/reducing significantly but I am seeing on firebase console user's can't ads. Right now it is around %3-%5 of users can't see. Before addPostFrameCallback it were raised up to %12. Note: In documentation Google is not using await (https://developers.google.com/admob/flutter/interstitial) but adding it and surround the code with WidgetsBinding.instance.addPostFrameCallback helped to reduce ads show errors. Note2: I checked the #1153, I guess that is only cover iOS bug. But I am still getting iOS show errors too if u check my first firebase screen picture, that is coming from app with mobile_ads v5.2.0 I am getting in Android, too. Actually error rate is higher in Android rather than iOS. Note3: If any flutter/native crash occur either first or second screen, interstitial ad may not be shown while switching first to second. This is not my case right now but still to remind users. |
@aykutuludag got it. It's possible those errors are working as intended based on the integration. Can you provide a minimal, reproducible example and I can take a look? |
I shared the minimal repdocible code in the first comment @malandr2 u can use that. I trimmed ads unrelated codes. I am calling showInterstitialAd function between screen changes. It is pretty standart implementation based on Google docs. |
yes, maybe same root cause, why there are 2 types of resume, and admob resume (foreground) very inaccurate |
Root cause seems to be same. Flutter Lifecycle and Admob Interstitial lifecycle seems to be is not coinciding all the time I guess. Also I am starting to get new error about last 2-3 weeks. I look it up on the internet but I couldn't find any info. Error Reason: The consent form has already been shown. |
Hi @aykutuludag, "The consent form has already been shown." is related to ad unit deployment where an ad unit may be used to gather consent. The form will not show if it has already appeared. I'm getting multiple compile-time errors when copying your code. Please provide a minimal, reproducible example and I'll be able to properly triage. For example, are you calling |
Yes I am showing ads between screen changes. changeScreen function is the responsible function to switching screens and here is the code:
function call: showInterstitialAd(context, changeScreen) This code is inside a button in First Screen. When user click it, it is opening SecondScreen and showing ads according to code as you can see. |
Hi @aykutuludag, try calling |
I'm trying to your solution and sending new version. Thanks I will notify about the issue if it continue. Note: I just applied your approach. First thing to notice that there is a delay between 0.4sec-2sec. In iOS screen changes more faster, on Android it is much slower. If I understand correctly, onAdDismissedFullScreenContent triggerred with delay. This delay causes the delay between screen changes. Problem is not about screen change code, it is about callback triggerred after 1-2 seconds of ads closed. |
Hi @aykutuludag, if |
I tried inside of onAdShowedFullScreenContent, it didn't consistent and gave the show fail error again. I applied inside of onAdDismissedFullScreenContent and now ad show fail reduced dramatically but not zero. I will write new errors once new release obtained by more user. The delay is a little bit problematic in Android it is between 300ms-2sec. In iOS, it is almost unnoticeable it is about 150-300ms. |
Okay I am getting new reports from Firebase. Bad news: Yeah the method you suggested decreased the rate of onAdFailedToShowFullScreenContent errors significantly, but I am still getting it. For iOS: the provided view controller is not being presented. Like I said it is decreased rate of the error significantly, but according to my early calculations show that it is still happen %3-5 (previous %10) of every session. Maybe it will go lower values. I will report new reports in a few days once more user get the update. Note: Also it would be great if we can reduce the delay of callbacks in the new versions of google_mobile_ads. Apps will look like much more consistent and fast. |
Hi @aykutuludag, it's very possible these errors are completely valid based on how the user is interacting with your app. Small sample size is also possible. I don't imagine it will go down to 0% because users will still be running old versions. Seeing a sharp decrease is great news. I recommend to keep experimenting on the timing of when to present full-screen ads to your users. The callbacks are determined by the Google Mobile Ads Android and iOS SDKs, respectively. You can create a new thread in the AdMob Developers forum to voice your feedback to the proper channels. Closing this out. Thanks! |
Flutter version: 3.24.3
Dart version: 3.5.3
Affected Android versions: Happening in every Android versions:
Affected iOS versions: Happening in every iOS versions.
The issue
This issue is still present google_mobile_ads: ^5.2.0. To be clear, I suspect that this error happening all kind of fullscreen ads (Open Ads, Interstitial Ads etc). Not happening in every time according to firebase data, it is happening around %10 of intertititial show calls. So only %90 of interstitial can be showed successfully.
Error Reasons:
For Android >>> The ad can not be shown when app is not in foreground.
For iOS >>> the provided view controller is not being presented.
For Both >>> The consent form has already been shown.
For Android:
Sceneario
As general the other apps, I am showing interstitial ads between screen changes. Here is my code:
Thanks to firebase logs i can see how many device can trigger the onAdFailedToShowFullScreenContent
As you can see if the device is Android errorReason is The ad can not be shown when app is not in foreground.. If it is iOS, the provided view controller is not being presented.
Adding WidgetsBinding.instance.addPostFrameCallback reduced the errors (I just released new version we can't see on the chart) but it is still continuing. Google should fix this because it is reduces incomes significantly. I don't think it is because of my dart code it is pretty standart based on Google examples and also many users getting this error. Kind regards.
Note: Is it possible that those device may installed some kind of AdBlocker and that adblocker not prevent loading, but showing? Maybe we are getting this error because of that. AdBlock may be blocking the display of ads by putting the application in the background? Of course, this may only explain half of the error. I can't explain why this error also occur in iOS too.
Note2: Calling ads first, then navigate screen or visa-versa, DIDN'T WORK. Same error, nothing changed.
Note3: I added following tags to AndroidManifest.xml but it didn't change too. With or without error rate and reasons always same. (https://developers.google.com/admob/android/optimize-initialization)
The text was updated successfully, but these errors were encountered: