Closing app that are in the background

Asked

Viewed 131 times

0

Guys, how do I end an application, not leaving it in the background but rather ending the process!

  • Is there any particular reason you want to do this? The philosophy of Android is to leave it with it.

  • Perform a battery manager, where in some cases would close all open apps in one click, this app and to perform tests.

1 answer

1

According to that one OS response in English, you can do something like:

@Override
public void onBackPressed() {

    android.os.Process.killProcess(android.os.Process.myPid());
    // a linha acima mata o processo
}

PS: It says that it won’t kill the task in memory, but it kills the process, so I think it serves

Browser other questions tagged

You are not signed in. Login or sign up in order to post.