So, I saw the answers to this question in Stackoverflow, but I did not find the final answer. So, I ran into a problem: I split Thread into Socket. And I create and run this thread using the Application onCreate method. And I need to intercept this thread when the application was killed from the list of recent applications. If the user presses the back button, the system will call onDestroy, and in this situation I can intercept the socket thread. But I can not intercept the stream of sockets when a user kills an application from the list of recent applications.
Does anyone have a definitive answer how to solve this problem?
source share