It is necessary that when the application is minimized, it closes.
How to track that an Android application has been minimized?
When the application is minimized, the
onStop() method of the
onStop() is called. Override this method and implement the functionality to close the application in it.
But in general, in Android, you do 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 itself.
When you minimize your application, call a method
onStop() Activiti and after method
onDestroy() , after which your Activiti will be completed. But none of this will immediately terminate the application.
There is a good post from CommonsWare on this topic.