title: How to check if application exited or closed android?
body: <p>I want to perform some activities like clearing cache, singletons clearing etc. I will write all this code in Service which will be background but I need this service to be triggered only when application is closed or exited.</p>
  
  <p>I cant put my code to statrt service in onDestroy of activity as whenever i will move between my activities it will call onDestroy of previous activity.</p>
  
  <p>How to know if application is exited.</p>
  
  <p>Example will really help.</p>
  
  <p>Thanks.</p>