Android : suspend not working with home button

It is an old subject, but still no answer.
Suspend is not working on android when the user press the home button.
In my game (Snake Bar, working on iOS) if this happens while the snake moves (loop), the game continues in the background, with music and sounds. No message sent.

When will it be possible to have this functionality (Classic to begin with) ?
Thanks

Hi @Georges22 thanks for the report!

Are you using a wait loop in the code? Since it occurs while the snake is moving it may suggest that Android is thinking that the app is doing something so is running it in the background. iOS is less easy going in terms of that and is more likely to terminate the app.

If you’re using a blocking wait and perhaps locking messages around it then that could explain the missing message.

Thanks, but :slight_smile:
Yes there is a loop with a wait (for a few milliseconds) with messages, but no lock messages anywhere.
All pending messages are received, but android does not send a message when the home button is hit.
It just puts the app in the background (off screen) but that is all.
I did not find a message sent by Android in this situation that I could handle.
iOS does send messages on all sorts of interruptions and it works correctly (see on app store).

Does it mean I should add a test in my wait loop (for android only) while this is not corrected in LC, and what kind of test ?
Music is still being played so I can’t use androidIsAudioPlayingInBackground…
All my controls are considered still visible…

Thank you for that information. If you could file a bug report here https://quality.livecode.com/ and include a copy of your stack showing the issue I’ll have someone investigate.

Hello. Solved. There was a conflict between the suspend and UIApplicationWillResignActiveNotification (only available on iOS) with a sort of “double suspend” and I simplified my suspend handler. Works on android and iOS now.
Thanks

1 Like