title: stop service when my app is not running in background
body: <p>I want to check new messages every 10 mins in the background using alarmManager/Service(I have written the code for the same) but since service runs even if the app is alive or dead .I want the service to stop if app is not running in the background .How do I do this ?</p>
  
  <p>Please Help.
  Thanks in Advance.</p>