googleads-mobile-unity: Detection of ads showing when app is in background is broken.
Step 1: Describe your environment
- Unity version: 2019.3.5f1
- Google Mobile Ads Unity plugin version: I can’t find it, should be latest.
- Platform: Android
- Platform OS version: Android 7.1.1
- Any specific devices issue occurs on: Samsung J5
- Mediation ad networks used, and their versions: Only Admob
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:
// Admob is initialized with:
MobileAds.SetiOSAppPauseOnBackground(true);
RequestConfiguration requestConfiguration =
new RequestConfiguration.Builder()
.SetTagForChildDirectedTreatment(TagForChildDirectedTreatment.True).build();
MobileAds.SetRequestConfiguration(requestConfiguration);
MobileAds.Initialize(initStatus => { adManager.OnAdInitialized(); });
// I load the ad with:
private void CreateAndLoadRewardedAd()
{
if (this.rewardedAd != null)
{
this.rewardedAd.OnAdClosed -= this.RewardedAd_OnAdClosed;
this.rewardedAd.OnAdFailedToLoad -= this.RewardedAd_OnAdFailedToLoad;
this.rewardedAd.OnAdFailedToShow -= this.RewardedAd_OnAdFailedToShow;
this.rewardedAd.OnAdLoaded -= this.RewardedAd_OnAdLoaded;
this.rewardedAd.OnAdOpening -= this.RewardedAd_OnAdOpening;
this.rewardedAd.OnPaidEvent -= this.RewardedAd_OnPaidEvent;
this.rewardedAd.OnUserEarnedReward -= this.RewardedAd_OnUserEarnedReward;
}
this.rewardedAd = new RewardedAd(this.AdUnitID);
this.rewardedAd.OnAdClosed += this.RewardedAd_OnAdClosed;
this.rewardedAd.OnAdFailedToLoad += this.RewardedAd_OnAdFailedToLoad;
this.rewardedAd.OnAdFailedToShow += this.RewardedAd_OnAdFailedToShow;
this.rewardedAd.OnAdLoaded += this.RewardedAd_OnAdLoaded;
this.rewardedAd.OnAdOpening += this.RewardedAd_OnAdOpening;
this.rewardedAd.OnPaidEvent += this.RewardedAd_OnPaidEvent;
this.rewardedAd.OnUserEarnedReward += this.RewardedAd_OnUserEarnedReward;
AdRequest request = new AdRequest.Builder().AddExtra("npa", "1").Build();
this.rewardedAd.LoadAd(request);
}
// And only show when the user clicks a button with:
rewardedAd.Show();
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.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (5 by maintainers)
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.
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?