The activity of the killed process is still displayed in the list after clicking [Home]

Like many others, I want to kill the Android application on the exit button. Actually kill, and not just go to the background and stop all active codes (I know very well that Android does not like it).

I found Process.killProcess(Process.myPid())and System.exit(0)that work fine (I have no problems with the activity stack, the "exit" button is in my Activity database).

But there's a problem. When I kill my process, and I returned to the shell, I click the [Home] button. It shows a list of apps that are in the background, including my app that was killed.

Is there a way to do this: 1) kill the process and 2) remove it from the list of Android applications that appears after the user clicks the [Home] button?

Thanks for all the answers (except for this stupid "you shouldn't explicitly close Android apps" :-))

+3
source share
2 answers

If you mean a list of applications showing a long press on the "Home" button, then this is not a list of applications in the background, but simply a list of the most recently launched applications.

+5
source

If you do not want your application to appear in the list of recently used applications, you can use the following code in your manifest.

android:excludeFromRecents="true"
+3

Source: https://habr.com/ru/post/1766163/


All Articles