defold / extension-admob

Defold native extension which provides access to AdMob functionality on Android and iOS
https://www.defold.com/extension-admob/
MIT License
37 stars 12 forks source link

Pause game engine during video & rewarded ads #39

Open SkaterDad opened 6 months ago

SkaterDad commented 6 months ago

Hello! Finally tinkering away with my games again, and have run into a problem with iOS vs Android.

On Android, when you show a rewarded video, the game completely pauses, and no code is executed again until the ad is closed.

On iOS, unfortunately for me, the game code continues to run while the ad is being displayed. This has led to unexpected bugs, since I developed first on Android.

Main issues this causes:

  1. We have to write code to pause/resume music
  2. Code that executes in the "reward completed" callback will execute before the game is visible again. On Android that is not the case.

I can code around these for now, but it would be convenient to make the platforms behave similarly if possible.

Unity's ad sdks have a convenience function SetiOSAppPauseOnBackground(true), but I am not sure how it works since it calls some External code.

https://github.com/googleads/googleads-mobile-unity/blob/main/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/MobileAdsClient.cs#L88

I wasn't sure if this would be better solved in this extension or the engine itself. I experienced a similar problem with DefVideoAds before I switched to Admob. Happy to move the request if needed.

Have a nice holiday season!