title: How to detect if the app has been killed using a service? android
body: <p>How do i detect if the app has been killed? 
  i have found a solution which is call activity on <strong>onDestroy</strong> </p>
  
  <pre><code>@Override
  protected void onDestroy() {
      super.onDestroy();
      Intent intent = new Intent(this, ConnectionStablizer.class);
      startActivity(intent);
      // code here
  }
  </code></pre>
  
  <p>it is working fine on galaxy note 3 (4.4.2) but not working on android emulator (android 4.2.2), galaxy y duos (2.3.6) and htc desire (4.0.2)</p>
  
  <p>so i found another solution-</p>
  
  <p>run a background service which detects when app gets destroyed and launch the activity again like <a href="https://stackoverflow.com/questions/21040339/how-to-know-when-my-app-has-been-killed">this one</a></p>
  
  <p>i have the exact implementation but it doesn't do anything? where am i wrong? my code is the same as in the link</p>