title: Job Scheduler vs Background Service
body: <p>I have an app which has a feature A which should run in background every minute. Feature A is that the app should connect to a database, read some data then get the current location of the device and based on them check a condition, if the condition is true it should send a statusbar notification to the user so that when the user clicks on the notification the UI of the app will be displayed and something happens.<br>
  This background task should run permanently every minute, regardless the app is used, closed, terminated (like facebook or Whatsapp that show us notifications regardless they are in the app stack or not).<br>
  Now I have searched and have found that Android offers <strong>Job Scheduler</strong>,<strong>Background Service</strong>, <strong>AlarmManager</strong> and <strong>Handlers</strong>.<br>
  But the more I read about them the more contradictory the statements appear to me.   </p>
  
  <ol>
  <li>About Handlers I have read that they do not exist for long delays
  and will be terminated after system reboot. So they won't be
  appropriate for my task.  </li>
  <li>But AlarmManager seems to be a good candidate for the problem because when permitted they exist even after system reboot and can
  rerun the app. But in the <a href="https://developer.android.com/reference/android/app/AlarmManager.html" rel="noreferrer">Android Documentation</a> that the Alarm
  Manager is intended to be used for tasks that have to be run at a
  specific time (like the Alarm Clock). But my task has to be run
  every minute.  </li>
  <li>Then there is Background Service. This is more for tasks like downloading in the background as I have read and not intended for
  doing something I have explained.  </li>
  <li>JobScheduler seems not to be for a task that has to be done in permanently, but for tasks that fulfill a specific constraint like
  idle, or no network...    So which of these (or other ones if they
  exist) do you recommend to use for the task I explained in the first
  part</li>
  </ol>