How do I handle phone call interruptions?

How do pause the game during unexpected interruptions like phonecalls, minimisation or when the screen blacks out?

1 Like

Use window.set_listener() to see when the game loses focus.

3 Likes

Pausing could be made in many ways but setting the collectionproxy time step to 0 is a nice way.

4 Likes

Remember that the engine doesn’t keep running in the background while the game is interrupted. But I’m guessing you’re after showing a Pause screen when the user comes back to your app?

1 Like

In current Defold state, it’s doesn’t matter how you handle this due to Defold inability to properly handle audio session interruption. Your game will lose any sound after such interruption (phone call, timer, Siri, etc), so user will be forced to restart app anyway.

I believe this was fixed in 1.2.122.

You should believe stronger. :slight_smile:

So it’s still not working? @Mathias_Westerdahl?

Yes, DEF-3130 was another issue, and DEF-1733 (which we are talking about now) is still unresolved.

1 Like

Oh, sorry, I misunderstood then. @dmitriy is correct.

1 Like

Has “handling audio session interruptions” been fixed?

I’m actually not sure, and I don’t have an iOS device available. Give it a try and let us know the outcome.

2 Likes

Once I’ve got some sweet tunes in the game I certainly will!

This issue still exists.

I’ve tested with a phone call and Siri and I can’t reproduce this issue.


2 Likes

Ok, so we need to figure out who’s right?

@AGulev vs @dmitriy!

1 Like

This may depend on the OS version and device.
Still exists here:
iOS 12.4.6 (16G183)
Model: iPhone 5s (Model A1457, A1518, A1528, A1530)
Model: iPad mini 2 (Model A1489)
Defold 1.2.167

2 Likes

Thank you for the full information, now this bug will be much easier to investigate and fix.

2 Likes