Prevent game closing

hello dear friends
i made a game and everything is fine , but when user want to go to home screen or just check another app , even for 10 second , game will be close completely and user should start from zero again

what can i do to prevent such unwanted closing?
thanks in advance

Hiya what platform? When you say completely close you mean when the user comes back to your game they get the loading screen etc, or they come back and your game is open but the scene is as if they just started the game and not as if they had been playing for awhile?

1 Like

hello dear @Lucky-j
Android Platform
yes after users come back to game , they get loading screen and then game go to menu
if user pause game , and go to another app and come back to game , still get loading screen and game will not resume
any way to fix this?

Heya buddy, I think this is a common thing because Android will kill things to free up memory if it needs to, among other things. I have been wondering about it because, I will give you 2 example games, both made with GDevelop. This first is a charming platformer I downloaded last November.

Anto: The Little Wizard - Apps on Google Play
This game I can generally put in the background, and open several other apps, and usually when I get back it is right where I left it, even if I was in the middle of a level. Very rarely I will go back and it will restart, and usually only if I’ve been gone a long time.

This other game is a fun space shooter I downloaded a few days ago

Space shooter X - shooter game - Apps on Google Play
This game, if I’m on my pc with nox, I can put it in the background and do other apps and when I foreground it back, the spaceship is exactly where I left it, but if I try that on my phone, I come back to a closed app every time, even if I was only gone a few seconds.

So why?? I have been trying to figure it out too. Does one really using that more memory than the other? Or is the Anto one using something that keeps calls going when the app is put in the background so the android system keeps it alive?

So I don’t know for now. But don’t worry too much. A lot of apps on android do that. One of my favorite games did that. It didn’t stop me from playing. It just made cheating slightly harder (but by no means impossible).

1 Like

Oh but I better ask, your game is saving so when they open it up they’re not lost progress?

1 Like

dear @Lucky-j
thank you for your attention to my question
I’m wondering how they keep game alive in background i really need that

my game is brick breaker and don’t save anything in phone , everything is based on Firebase
if is there any guide to keep game alive in background i will be very thankful if you tell me too

1 Like

Ok if I find out I will tell you. It’s a lot of reading and I don’t know how it applies for this engine.
I don’t know if any of these are helpful.


(Stopping and Restarting an Activity | Android Developers)
The activity lifecycle | Android Developers


thank you my friend @Lucky-j

1 Like