- Home /
Interstitial pause game on Android but not on iOS?
Hi all,
I got a query about Admob Unity plugins. I made a interstitial ads for Android and iOS. When I load it on Android, it pauses the game but it doesn't do it on iOS?
Kind regards
Answer by luciano_unity · Jul 17, 2018 at 01:08 AM
If anyone else runs into this, Google added a special method called MobileAds. SetiOSAppPauseOnBackground()
to handle this issue. Just set this to true
before initializing your MobileAds
entity.
See this for issue details: https://github.com/googleads/googleads-mobile-unity/issues/388
See this for a demo: https://github.com/googleads/googleads-mobile-unity/blob/master/samples/HelloWorld/Assets/Scripts/GoogleMobileAdsDemoScript.cs
Answer by christougher · Sep 20, 2017 at 04:38 AM
Hi, yes, super annoying. I've managed to get it working mostly right by including code like this:
#if UNITY_IOS
Time.timeScale = 0;
AudioListener.pause = true;
#endif
then you set them back to 1 and false when the ad is done
I'm still running into issues, such as when an interstitial ad has a short 5 second video and then transitions to a separate ad my game sets the timescale back to 1 and the game plays before the ad is closed out. Super annoying! I really wish it would pause for IOS automatically. I have no problems on Android.
Answer by brkbkc · Jan 08, 2021 at 11:50 AM
This is an old post but i am having the same issue now. I set ads at game over screen. After the game over, method is called to show interstitial but while ad is loading player push start button and passes the game then ad shows. The problem, there is a countdown in the game and it continues while ad is showing. I add this MobileAds. SetiOSAppPauseOnBackground(), but in this time there is an error on ios. Xcode debug shows me errors (Something like this "AVAudioSession_iOS"). This error also effects game and some functions not working especially game sfx. Any help? please. Thanks
Answer by Tibi_th · Nov 29, 2021 at 12:05 PM
luciano_unity's solution worked perfectly. Didn't even know of such a bool. Major time saver! Thank you!
Answer by tobias_unity · Jan 10 at 01:59 PM
Any suggestions on how I make the game resume while ads are shown? Mine is pausing the game even after I add "False" to the code.
MobileAds.SetiOSAppPauseOnBackground(false);
Is there something similar to controle pause on Android as well?
Your answer
Follow this Question
Related Questions
Admob on IOS not working 1 Answer
Admob Memory Issues 0 Answers
How to integrate AdMob with iOS? 1 Answer
Unity Admob Implementing Interstitial 1 Answer
Admob Interstitial Ads are not working in IOS, but it is working in Android 0 Answers