title: Android Service for recording on background
body: <p>I need to implement a recording service on android. i have been investing a lot of time reading about services, working on the backgroud in android and yet i still havent figured it out yet. this is what i have done so far :</p>
  
  <ol>
  <li>i started by implementing a service that creates and maintains an AudioRecord instance on its onCreate</li>
  <li>i subclassed Application and started the service from application's onCreate</li>
  <li>i bind to that service from MainActivity on onResume and unbind on onPause</li>
  <li>the service's onBind works like LocalService sample from Android SDK samples, meanning that i return binder that holds the service instance and have a getter for it</li>
  <li>the service API lets its clients start and pause the AudioRecord it maintains</li>
  </ol>
  
  <p>Now what i expcted was that the service's onCreate would be called only once for the time the application started it, but surprisingly, it seems like sometimes when i bind to that service the service restarts (onCreate and onStartCommand is called)!</p>
  
  <p>this behaviour is very bad for me as when the user starts the record from the MainActivity
  (using the service instance API)and then presses home and then goes back to my app again,  the service's onCreate is being invoked again and the AudioRecorder is being recreated!</p>
  
  <p>what am i missing?</p>