Google Mobile Ads cause my Unity app to pause while interstitial is shown?

2,843 views
Skip to first unread message

Martin Asenov

unread,
Oct 19, 2017, 5:11:21 AM10/19/17
to Google Mobile Ads SDK Developers
I'm using Google Mobile Ads + Google Play Services in my Unity game.

When export to Android, whenever interstitial is played, the app's execution is frozen. Behaviours' Update() are not called and basically I cannot do any background operation.

Interestingly enough, Google Mobile Ads does not behave this way on iOS builds, there the app continues running.

Pausing does not work for me, because I have real-time multiplayer game and the client needs to ping the server, track time and also other stuff, including during ad being shown.

How to prevent Google Mobile Ads from pausing my game?

Deepika Uragayala- MobileAds SDK team

unread,
Oct 19, 2017, 1:56:23 PM10/19/17
to Google Mobile Ads SDK Developers
Hi Martin,

This sounds like an implementation issue to me and something we have never come across before. If you can provide us a sample app that reproduces this issue, we will gladly have a look into it. Also, can you first test with our sample app to see if you are able to reproduce this? 

Regards,
Deepika Uragayala
Mobile Ads SDK Team

Martin Asenov

unread,
Oct 21, 2017, 8:26:05 AM10/21/17
to Google Mobile Ads SDK Developers
Hi, Deepika,
yes, I can totally reproduce it with your sample HelloWorld app.
This is what I did.

1) I imported the HelloWorld app in both Unity and MonoDevelop.
2) I added Google Mobile Ads 3.7.0 Unity package
3) I added two of my mediation integration libraries that I use for my ad unit, Unity Ads and AdColony ads as per their respective documentation https://developers.google.com/admob/unity/mediation/unity and https://developers.google.com/admob/unity/mediation/adcolony under Plugins/Android folder
4) in  GoogleMobileAdsDemoScript I changed line 25 with my app id and changed line 227 with my ad unit id. Also put Debug.Log("update") inside the Update() method.
5) Deployed on device. Device is Samsung Galaxy J5 (2016). Run the application with Unity profiler autoconnected.
6) App is ran on the device successfully, Profiler tracks the performance, "update" is printed in the console every frame.
7) Request interstitial.
8) Show interstitial. Interstitial is being shown. Please note that this is real interstitial as I've not enabled test ads so that I can see a real ad. Some video ad from some random game is played from Unity ads.
9) From this point on, up until I close the ad, the profiler freezes, so does the "update" print in the console.
10) I close the ad, profiler resumes, so does the "update" print in the console.

Same thing is reproducible in my game as well. Please address the issue as it is a big problem. App should not get frozen at all as I need to do background activity while interstitial is being shown.
As I said the very same setup does not result in freezing on iOS devices. Everything is fine there.

Thanks

Martin Asenov

unread,
Oct 21, 2017, 8:32:04 AM10/21/17
to Google Mobile Ads SDK Developers
This is the software used:

Google Mobile Ads 3.7.0 Unity package
AdColony and Unity ads packages both latest versions.

Unity 2017.2.0f1

The OS on the device is Android 6.0.1 Marshmallow

Martin Asenov

unread,
Oct 21, 2017, 8:37:03 AM10/21/17
to Google Mobile Ads SDK Developers
Also please note the very same behavior is observed when using Google Play Games library and I try logging in to Play Games. While the green popup is being active, the app freezes as well.

Deepika Uragayala- MobileAds SDK team

unread,
Oct 23, 2017, 3:13:59 PM10/23/17
to Google Mobile Ads SDK Developers
Hi Martin,

Thanks for confirming and sending additional information. Could you send us - Charles logs, Ad Unit ID and device logs when this happens? Also, were you able to reproduce when an Ad from our AdMob network is served? See if you are able to reproduce only with our AdMob network and do let us know. 


Regards,
Deepika Uragayala
Mobile Ads SDK Team

Martin Asenov

unread,
Oct 23, 2017, 3:38:27 PM10/23/17
to Google Mobile Ads SDK Developers
hi, it happens with ads from AdMob network as well. It is reproducible with any kind of ad network.
this behavior is not observed, when using test ads - even when the ad overlay is on the screen, the app continues working in the background.
I'm pretty sure if you follow the steps I've described and trigger real ads from whatever ad network you will reproduce it too.

Cheers
Message has been deleted

Deepika Uragayala- MobileAds SDK team

unread,
Oct 24, 2017, 3:17:29 PM10/24/17
to Google Mobile Ads SDK Developers
Hi Martin,

Thanks for getting back to us. So, we were able to reproduce the issue and the team has got back on this. The SDK will not not allow any callbacks via Update() to be fired when an Interstitial AdView is being presented. The iOS plugin will now be updated to match Android where the plugin would pause the presenting Activity when the Ad is shown. Also, you can use OnApplicationPause() callback to know when this is called on your App and save any data if required.

Let us know if you have any questions. I'll be happy to help.

Regards,
Deepika Uragayala
Mobile Ads SDK Team

Martin Asenov

unread,
Oct 24, 2017, 4:07:10 PM10/24/17
to Google Mobile Ads SDK Developers
hi, Deepika,
so you are making it worse for me. Initially I said this was my problem - the game is paused when running an ad. I need my app NOT paused when interstitial is running, this is my issue.
I need the ad to continue working in the background, Update() being called, etc. 
It is real time multiplayer game, I need to call the server from the background too, so the game should be executing while ad is being played.
Is there a parameter in the config or whatever I can set in order to not have the ads pause the game.
I ran away from native Unity ads because they were pausing the game. Now AdMob does the same.

How to prevent the game being paused when ad is shown in the first place?

Thanks

Deepika Uragayala- MobileAds SDK team

unread,
Oct 25, 2017, 2:38:31 PM10/25/17
to Google Mobile Ads SDK Developers
Hi Martin,

Our team has decided to pause the Unity Run loop via Update() callback when an Interstitial is being presented on both the platforms now. As mentioned earlier, you would have to pause your game when an Ad is being shown and then resume once the user closes it.

Regards,
Deepika Uragayala
Mobile Ads SDK Team


Ticker 92

unread,
Oct 25, 2017, 3:52:56 PM10/25/17
to Google Mobile Ads SDK Developers

Martin Asenov

unread,
Oct 25, 2017, 4:01:15 PM10/25/17
to Google Mobile Ads SDK Developers
I think you are missing my point. As I said I don't want the game paused when ad is displayed. How to get around this?
Is there a setting, config, whatever I can use to make the ads NOT pause my game? Thanks

Ram Parameswaran (Mobile SDK Team)

unread,
Oct 25, 2017, 4:47:16 PM10/25/17
to Google Mobile Ads SDK Developers
Hey Martin,

There is no setting provided by the GMA Android SDK or GMA Unity plugin that would accomplish what you are asking for. You can try investigating the workaround I mentioned in the issue tracker for the plugin.

- Ram

Martin Asenov

unread,
Oct 27, 2017, 5:01:36 PM10/27/17
to Google Mobile Ads SDK Developers
Deepika,
Which version of Google Mobile Ads do you plan to introduce that consistent behavior for both iOS and Android? When is it going to get released?

Ram Parameswaran (Mobile SDK Team)

unread,
Oct 31, 2017, 3:17:41 PM10/31/17
to Google Mobile Ads SDK Developers
Hey Martin,

At this time we're unable to provide a concrete ETA on this update to the GMA Unity plugin. For the time being, to make the behavior consistent on your end you can pause your app from within the OnAdOpened ad event.

- Ram
Reply all
Reply to author
Forward
0 new messages