title: Is it possible to programmatically ask Android to SaveInstanceState?
body: <p>I am new to Android and making my first real app and it uses the <code>socket.io</code> Java Client for communicating with my <code>Node.JS</code> server instance. I have recently discovered while testing that the OS can kill background apps whenever it feels necessary calling <code>onSaveInstanceState()</code> on the active <code>Activity</code> then when you switch back to the app it recreates the previous state using the <code>Bundle</code> passed as an argument in the <code>onCreate()</code> method.</p>
  
  <p>So now that I know that, I need to implement a solution that would keep the app working as it should so I expect I will have to test a few solutions before I get the right one. And since it would be so time-consuming to just lock my screen and watch the server logs waiting for the</p>
  
  <p><code>User disconnected</code></p>
  
  <p>(which can take a lot of time for each try), I wondered if anyone here ever was in the same situation and figured a way to make the OS kill the app as soon as I lock the screen or hit the Volume Down button or something like that.</p>