title: How to stop application/service from destroying?
body: <p>I have an application that has a single screen with a "start logging" button, which starts a service. After it is pressed, the button changes to a "stop logging" button and stops the service onClick. This service essentially grabs some data every minute and writes it to a couple of SQLite tables. </p>
  
  <p>The application is designed to be opened, start logging.. and then minimised and left in the background to run. However, the problem is that after a period of time, Android destroys/stops the process/service/activity so that it no longer logs data, and when the application is reopened, the screen is reset so that it says "start logging" again instead of "stop logging" because the application has been restarted.</p>
  
  <p>I'm looking for the application/service to be able to run in the background and collect data for as long as it wants, and for the activity to remain open or in a state where when it is opened, I can stop logging rather than having the screen reset. Basically, the application is minimized forever when logging and not closed. </p>
  
  <p>Thanks for any help or advice.</p>