game music still playing during AppLovin Ad on iOS

Does anyone know how I can have my game SUSPEND on iOS in the same way it does on Android, where it temporarily stops the code from running until RESUME?

I’ll answer as best I can. My games are mostly coded the same way they were coded 10 or 15 years ago. I am an old man. I use game loops. For each click of the loop (enterFrame) I calculate any data change and then I update the UI based on the data. So for me to pause the game is fairly simple. When it goes into the loop if my game is not visible I do nothing in the loop.

But your subject talks about sound. I just pause those when the game is not visible.

How do you check if your game is visible?

It’s an annoying issue while showing ads on ios but most developers seem to not handle it so we just let it be in our apps lately.

The only proper way we were able to pause and resume audio was by using the listener for the ad service and checking when an ad was “shown” and when it was “closed” and using these events to toggle audio. It helps if you have a single ad network and use mediation otherwise if you are going to do it with multiple ad plugins all with their different APIs, it could be cumbersome.

The app technically remains in the foreground on ios when an ad is being displayed so I doubt there’s any other straightforward way to solve this

That is exactly what I was going to say. Ad shown and closed events. It has been a while since I have used my own waterfall with multiple networks. But I see how that would be cumbersome.

I’m using AppLovin (with multi network mediation) and I can turn off game sounds and music when it starts. Now, I just have to find out how to get the callback when the ad ends.

On iOS 14+, although I can turn off the game sounds and music just before the Ad starts, my attempts to restart audio after the Ad continually fail on iOS 14+. I recently found that it works fine on iOS 12. Can anyone provide some insight into this problem?

I could never solve this issue with AppLovin, so I moved to Scott Harrison’s ironSource plugin and am now using their mediation with Admob, Facebook and their own ironSource network to compete for ads; although AdMob will only fill, but not bid.

1 Like

Darn it! Audio drops when an AppLovin ad has completed.

This next comment is not a swipe at the Solar 2D community or its developers. Just to say it is beyond belief that the ‘audio drop on ad completion’ is still ongoing after all these (5+) years. This nonsense used to happen frequently on Vungle on and off for years. I can appreciate that there’s so many moving parts with mobile development. Still, after faffing all morning with the nightmare that is certificate and profile provisioning (deleted all and started again in the end) I lose the will to bother with mobile development at times.

I could switch to ironSource - but am I swapping one problem (audio dropping) for another? I’ll see if I can get audio to resume with AppLovin…

Suspend followed by resume does bring the audio back. SMH