How to gracefully terminate an Android Toga app ? #2832
MarusGradinaru
started this conversation in
General
Replies: 1 comment 6 replies
-
|
The short answer is "you don't." Mobile apps don't generally have "quit menus" or an equivalent action to exit, and as a result, we don't expose There has been some discussion about this in the past; see #1623 for details. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a button on my toga.App UI and when I press it I want the app to be terminated in a gracefull way, doing all cleanups, and be removed from the Android task manager, like it never existed.
So far, I've done like this:
In Toga:
in MainActivity.onDestroy:
And it completelly terminate the app process. But it says that some cleanup was skipped:
So, what is the proper way to exit an Android Togga app ?
The AI recommended me to use "android.os.Process.killProcess(android.os.Process.myPid());" as it does more cleanup than "System.exit(0);", but it trows a big exception:
Beta Was this translation helpful? Give feedback.
All reactions