Unity Android ads SDK has a severe problem: it will create an interstitial ad in the background while the user switches the app between foreground and background very quickly.
When the app's "onResume" is called, I will call Unity to show an interstitial ad. But if the app goes to the background before the ads showed, Unity SDK will also pop the ad. This's bad. How can I stop this?
Thanks!
Related
Do you know this "W/Ads: It is not recommended to show an interstitial when app is not in foreground."
How can i prevent this Warning/Error , I'm trying to show an interstitial when app is on foreground but the device is lock,under security.
on some device i'm can display interstitial when the device is lock and on other device i'm block.
Any Ideas?
You try to show an interstitialAd while the Activity is not in foreground.
You have to check if your activity is in foreground. If so, show the ad.
For example implementing a lifecycle listener.
After resume check if ad is loaded and show it.
GGK
Previously I used Unity Ads to display interstitial and rewarded ads in my game made with unity but now I'm switching to Google Ads (AdMob).
I read documentation from here and next from here and everything seems like it's working, but kinda slow.
I have 3 scenes:
Main Menu
Game
Shop
I need to display rewarded ads in Game and Shop scenes. In the Game scene, the user has the ability to watch an ad to continue where he dies. He have only 5 sec to do that. If he doesn't watch an ad, then he has the ability to watch another ad for +25 coins, to restart the game or to go to the main menu. From the Main Menu scene, the user has the ability to go to the store to buy some more characters and here he also has a button for +25 coins if he watches rewarded ad. So, there are 3 places for the rewarded ad.
In the Main Menu script, in the Start() method there is:
MobileAds.Initialize(appId);
The problem is, when the user clicks on the "Store" button in the Main Menu scene, in the Start() method I'm calling
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the rewarded video ad with the request.
rewardBasedVideo.LoadAd(request, adUnitId);
and the user has the ability to immediately click on "View ad" button which does this:
if (rewardBasedVideo.IsLoaded()) {
rewardBasedVideo.Show();
}
and there is a problem... Rewarded ad is still not loaded, it will be loaded after 1.5s - 2 s from calling rewardBasedVideo.LoadAd(request, adUnitId); So, the user must click it multiple times until ad appears.
I checked a lot of other games which uses AdMob and every game immediately show ads. How? Is there a way to preload rewarded ad?
It's also a bad UX when die modal appears and user have 5s to watch rewarded ad until he is "fully dead" but the ad is available after ~3s.
Also in the store, after watching the ad, user has ability to watch it again, so in OnAdClosed I putted the same logic for loading new ad but it's also slow and after few seconds the ad is actually loaded and I tested other games - they don't have that problem.
Do You have any advice?
You need to call
rewardBasedVideo.LoadAd(request, adUnitId);
As soon as the app launches.
This will load and prepare the ad for when the user is prompted to watch it.
I ussually have an empty gameobject with a script called "AdManager" which loads the ad. It has a static reference to itself (singleton pattern) so i can easilly call it from other scripts.
That way when the app launches, the ad is prepared and when I want to display it, i can call it from wherever i want to.
Regarding displaying a new one after the previous one has ended. I do not see a viable option other than physically having to wait untill it is loaded. (Keep in mind that an Ad can be pretty big in Data)
hi I am new in admob ads and I just start using it, I created a simple ad and it worked fine but when I exits the app and run it again the ad disappeared and stopped showing, and then I tried again after closing and opening the app the ad appeared after 60 seconds, any one know the reason of this.
It is likely that when no ad was showing there was no ad available for your app at that point in time. You may find that while your app is still making few requests that it doesn't always get an ad response.
I am using InMobi 5.2.1 android SDK for interstitial ads...
The ads are loading fine... However when the user clicks on the ad (to open the web browser), and goes back quickly, sometimes the ads are left open with no way to close it.
Clicking on the X does not seem to work, nor the back button..
When clicking on the back button I get the following error log:
Unimplemented WebView method onKeyDown called from: android.webkit.WebView.onKeyDown(WebView.java:2310)
I've tested this on 2 lollipop devices with the same issue.
Any clues?
I've integrated AdMob with my app. I can't seem to find this in any AdMob references.
Are AdMobs still running and bringing you revenue even if the app is in background or the ad is not visible? (for example
the user pressed the "Home" button
the user turned off the screen
the ad is positioned outside screen bounds
In my opinon this is clearly a wrong behavior if AdMob is still requesting ads and paying money per impressions in any of the above cases.
How does this actually work? Can anyone point me to a link/reference that exaplains this behavior?
Thanks
Clicking back, home, or closing your phone will pause your application but not terminate it. It is possible to run your application as a Service\WakeLock and it will continue to run in the background. Admob requests should not be running in the background if your application is paused. You should not be receiving impressions or revenue while your application is in the background.
Quote from AdMob: background requests?
You can see in LogCat when AdMob is requesting ad. Are you seeing any
requests when your app is in the foreground (you should), and when
your app pauses (you should not see any requests)?
By: Android Dev Guy