Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Android / [SOLVED] Cleanest way to exit / terminate an app without it staying frozen 'Tap/click the screen to exit.' in Android?

Author
Message
PHeMoX
7
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 8th Dec 2024 10:25
Hello everyone. It's perhaps a bit of a beginner question and something I'm overlooking, but how to best end an application on Android cleanly without it staying stuck frozen with the 'Tap/click the screen to exit.' message when trying to start it again? (Ironically the tap/clicking the screen won't make it disappear normally, you have to swipe the app out of active apps before it allows an app restart. For a casual audience I don't really want this.

I have a repeat loop for the main game, then at Back pressed or ESC pressed it exits just using the End command. Why does the app stay frozen afterwards and is there a way to prevent this from happening?

The author of this post has marked a post as an answer.

Go to answer

Zappo
Valued Member
20
Years of Service
User Offline
Joined: 27th Oct 2004
Location: In the post
Posted: 10th Dec 2024 03:18 Edited at: 10th Dec 2024 03:21
This post has been marked by the post author as the answer.
Android won't let you completely quit the game. It looks after its own memory management for apps and is actually pretty good at it. It will basically jump out of the app but leave it available in memory in case you want to access it faster in the future. If it isn't used for a while and something else needs the memory, then it will gracefully close the app itself. You don't get to control that.

The best you can do is use the "End" command from inside your main loop. This way your app will appear to close but stay available in the background. If the user runs it again or uses the task switcher to go back to it, it will continue in your main loop. This is what I do with my games. I never actually exit from the main "do loop".
PHeMoX
7
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 19th Dec 2024 12:56
I'm willing to believe you, however if I use End in my main loop, it will create a frozen app that is minimized with the message 'Tap/click the screen to exit.' which doesn't do anything on Android except minimizing it again (obviously it is called in something like 'if ESC / back button pressed' statement. For now I will be using MinimizeApp() instead, seeing how it won't close anyway. Thanks for your response!

Login to post a reply

Server time is: 2025-06-20 18:53:56
Your offset time is: 2025-06-20 18:53:56