Closed rafael-f closed 1 year ago
I believe that this is an issue with either Unity or the Mobile Ads SDK, I have also been able to reproduce this issue, it reproduces if you press the 'sleep' button on the device when the app is in foreground after loading the ad, then unsleep and try to show the ad. Internal bug reference b/157633635.
An update, we believe this may be a Unity issue as we have found that this problem does not occur when Unity's development build is off. So this should not occur in release builds.
Indeed I had development build on, good to know.
I am experiencing this issue even without development build enabled. Release versions have this bug too. Any idea how long we might have to wait? Or if downgrading to an older version of MobileAds Plugin might fix this issue?? Thank you.
@gambit19 can you provide an example of how to reproduce this issue - also what devices are you seeing this on?
If you would like to communicate with our team on this privately, you can open a thread on our developer forum and when the support team replies, hit 'reply privately to author'.
@stowy Thanks for your response.
Steps to reproduce the issue:
1.) Build a test APK with Google Admob interstitial or reward video ad enabled. (We are using GoogleMobileAds-v5.1.0 and test IDs) 2.) Add a button or a scene transition upon which interstitial.Show() or rewardedAd.Show() method is called. 3.) Just after the scene transition has started or immediately after clicking the button which calls interstitial.Show() or rewardedAd.Show(), hit the home button (before the ad appears) on the Android device (or minimize the app to home screen), the ad appears out of the scope of the application (on the home screen). 4.) Using onApplicationPause(or onApplicationFocus) isn't making any difference, the ad still shows up on the home screen if you time the home button click perfectly.
We aren't using the callbacks in any way, if that is relevant. We have tried pre-caching the ads and displaying them, and requesting for the ad directly and displaying them. It didn't make a difference. We have tried displaying the ad on different lifecycle methods provided by Unity, to make no difference. Ad still appears out of the scope of the application. We have not enabled development build on, as previously mentioned.
Devices we are able to reproduce this bug on: 1.) Samsung J2 (Android 5) 2.) Moto C (Android 7) 3.) Infinix X573 (Android 8)
Thanks @gambit19 for this detailed response. Are you able to provide a video reproducing the issue?
Yes. we can reproduce same issue with rewarded-video ad also.
Hello, Same issue, came here to let you know. After installing with Build n Run Development build, Admob not showing interstitial ( while other networks work perfectly ) its thinks that application in background. Hiding and showing app, helps to resolve this. Open app manually not reproduces this issue, its works only with BuildnRun.
This issue still occurs if the user locks and then unlocks the screen while an rewarded ad has been loaded (but not active). The issue occurs regardless if the build is a release or a development build.
The error message: "Rewarded ads that show when your app is in the background are a violation of AdMob policies and may lead to blocked ad serving."
This prevents new ads from loading and showing correctly. This seems like a false detection of a violation by the AdMob plugin since locking/unlocking the screen while the app is open is quite normal for any user.
We're using Unity 2019.4.16f1 and the latest AdMob 5.4.0 for Unity.
Has anyone been able to resolve the issue?
This issue persists in the latest Unity 2020.3 and AdMob 6.0.0 (although obviously it's an AdMob issue, not a Unity one).
When can we expect this to be resolved?
The issue still persists with AdMob 6.0.2 and latest mediation network adapters (updated in early August 2021).
@stowy
We have the same issue after the Lock/Unlock screen with AppOpen but only with 2 devices: Xiaomi Redmi Note 9 (android 10) and Xiaomi Redmi Note 6 Pro (android 8.1.0). All other devices work fine. Do you have any ideas if it could be resolved on our side?
"Ads: Interstitials that show when your app is in the background are a violation of AdMob policies and may lead to blocked ad serving. To learn more, visit https://googlemobileadssdk.page.link/admob-interstitial-policies" nAdFailedToShowFullScreenContent:adNetwork=admob code={ "Code": 3, "Message": "The ad can not be shown when app is not in foreground.", "Domain": "com.google.android.gms.ads", "Cause": "null" }
Issue is still there, 2020.3.24 / 6.1.2
I am still getting this with Unity 2020.3.41 / GoogleMobileAds 7.3. Is there a fix in place for this yet?
This is causing a lot of issues for me. Would a work-around solution be to reload new ads each time a player re-opens their device?
Hello @schichko,
We currently do not have a solution at the plugin / SDK level. I will ping the team to remind them of this issue.
That said I do see a work around by modifying the UnityActivityListener
@Override
protected void onResume() {
super.onResume();
mUnityPlayer.resume();
KeyguardManager keyManager = (KeyguardManager) this.getSystemService(Context.KEYGUARD_SERVICE);
KeyguardDismissCallback keyguardDismissCallback =
new KeyguardDismissCallback() {
@Override
public void onDismissSucceeded() {}
@Override
public void onDismissError() {}
@Override
public void onDismissCancelled() {}
};
keyManager.requestDismissKeyguard(this, keyguardDismissCallback);
}
For anyone coming across here through a search, here is one possible cause:
I was stuck with the same issue, but then I found the following Unity forum entry and it gave me a new lead. https://forum.unity.com/threads/game-is-preventing-the-lock-screen-from-appearing.205632/#post-1394429
When the development mode is enabled, pressing the sleep button and pressing it again will bring back the app, but the device is actually still locked. The AdMob SDK will interpret that as still in background. On production builds that won't be an issue, since it will always force a lock screen first. I could verify that ads showed up without issues when properly unlocking the device first.
I am having this problem in my app using:
Unity version: 2022.3.10f1 Google Mobile Ads Unity plugin version: 8.5.2 Platform: Android Platform OS version: Android 13 Any specific devices issue occurs on: All Android devices tested Mediation ad networks used, and their versions: Only Admob
Banner ads show correctly at app start, and as long as the app stays in focus. If users switch to a different app, or the phone locks, on app resume the banner ads are no longer visible. This only happens on Android, the same app on iOS works fine. It happens in both development and release builds.
@NVentimiglia , I see your workaround above, but I am not sure how to implement it. I tried creating a Unity plugin following https://docs.unity3d.com/Manual/android-custom-activity.html, but could not get it to work.
Can you provide instructions?
Step 1: Describe your environment
Step 2: Describe the problem
I was testing a build on my device and got the following warning message: "Rewarded ads that show when your app is in the background are a violation of AdMob policies and may lead to blocked ad serving. To learn more, visit https://googlemobileadssdk.page.link/admob-interstitial-policies"
It was followed by an OnAdFailedToShow callback with No Fill error.
This is weird because I was using the test ID : "ca-app-pub-3940256099942544/5224354917"
Steps to reproduce:
I believe I got maybe a notification and the plugin wrongly detected that my game was showing ads on background?
I couldn't replicate this.
Relevant Code:
It should NOT in any way ever show a hidden ad, this is a scary message to see popping up, and I believe there is probably an error on the plugin on whatever handles this check.
I was looking at my app with the device attached to logcat when I saw this warning pop up.