title: How do I detect if the user has left my app?
body: <p>I am developing an Android app and I want to detect when the user exits my app either by clicking the Back button or the Home button. </p>
  
  <p>Also, an event like <code>onInit()</code> would be useful in my scenario, as I just want to have the <code>MyInıt</code> action start at first.</p>
  
  <p><code>onDestroy()</code> is not called until other apps need more memory.</p>