It is necessary that when the application is minimized, it closes.

2 answers 2

Although it is not recommended to do this, you can kill the entire application process in onStop:

public void onStop() { android.os.Process.killProcess(android.os.Process.myPid()); super.onStop(); } 

    How to track that the application on Android was minimized?

    When the application is minimized, the onStop() method is onStop() . Redefine this method and implement in it the functionality for closing the application.

    But in general, Android does not need to manually close applications . Application state management is a function of the OS itself, which, if necessary, will unload your application from memory.

    When you minimize your application, the onStop() method will be onStop() , followed by the onStop() method, after which your activation will be completed. But all this will not lead to the immediate completion of the application.

    There is a good post from CommonsWare on this topic.