How to close Android application ?
Monkey Targets Forums/Android/How to close Android application ?
| ||
How can I close an application in code? |
| ||
Error "" |
| ||
I normally wrap:Error "" in a function called ExitApp: Function ExitApp:Void() Error "" End Nice and easy to remember ;) |
| ||
thanks! |
| ||
This used to work, but now it appears to be restarting the app instead. Does anyone know a good way to completely exit and Android app? I know that we're not "supposed" to, but every time I release an app that doesn't completely exit, I get negative reviews and emails telling me that I suck because my app doesn't completely exit, so it would be nice if the back button would exit the app somehow. Not sure what to do. EDIT: I got MonkeyGame.activity.finish() to work, but it still leaves the process running in the background. I also got System.exit(0); working, and it does kill the process, but apparently this is taboo for some reason. |
| ||
im using the latest version of monkey and just tested this on my phone and it still works fine on that. |
| ||
Same here. BTW: You never should really exit an app on a mobile device. Usually the OS takes care of that. That's why there are OnSuspend and OnResume methods. On iOS it's actually a rejection reason if you exit your app. I've had this once... |
| ||
You never should really exit an app on a mobile device. I hate that, I know its meant to be "standard", but I really think its stupid. Mobile devices have limited battery and memory, so why keep an application running in the background when the user has finished with it!?! On iOS it's actually a rejection reason if you exit your app. I've had this once... Strange... I havent, and Angry birds quit the application when leaving via the main menu. Is it new? |
| ||
Strange... I havent, and Angry birds quit the application when leaving via the main menu. Is it new? Don't know. But I have an explicit "Exit" button in my game Tic Tac Toe Wargames which I had to make "unfunctional" for the iOS version. I even attached some kind of special effect for that exit. |
| ||
The reason I'm adding a full-on exit method is because users ask for it all the time. Just Android tho, nobody complains about this on iPhone, just seems to be Android :) I might add an actual "exit" button to my Android App too, otherwise I get emails from people saying they don't know how to exit the app. |
| ||
I tweaked mojo.android.java a tiny bit so on pressing of the "Back" button, instead of a mock "KEYCODE_ESCAPE" keypress being generated, the "onBackPressed" handler gets called. The handler itself is just: @Override public void onBackPressed() { super.onBackPressed(); }Which has the effect of popping the Monkey activity off the activity stack. Didn't like that [monkeycode]Error ""[/monkeycode] purposely causes an exception as a means to exit the app. |