title: How to force killing application when minimizing in Android
body: <p>Right now I'm developing some kind of password manager &amp; generator application and it is almost done but I'm facing a problem that seems a bit hard to solve.</p>
  
  <p>In order yo improve the security of my app, I added a timer so if the user is under inactivity the app will close. Now I'd like to close the app every time the user want to minimize it (pressing the "HOME" button and the "RECENT APPS" button). </p>
  
  <p>I've tried <code>onStop()</code> and <code>onPause()</code> but nothing works because every activity on my app when is replaced by another moves through the mentioned states. Since I can't use <code>Keycode == Keycode.HOME</code> how could I do that?</p>