title: Execute code at specific time: Handler? AlarmManager?
body: <p>I need to execute code at intervals, sometimes 10 seconds, sometimes 5 minutes. The code should be executed at <em>exact</em> 10 seconds from start, then at <em>exact</em> 5 minutes and 10 seconds from start, etc.<br>
  A Chronometer is ticking along from the start, so the execution time <em>must</em> be accurate.</p>
  
  <p>Using <code>Handler.postDelayed</code> does not work, because the code to execute could take some time. The next execution of the code could be late when that happens.</p>
  
  <p>When I wanted to implement <code>AlarmManager</code>, I saw the note </p>
  
  <blockquote>
    <p>The Alarm Manager is intended for cases where you want to have your
    application code run at a specific time, even if your application is
    not currently running. For normal timing operations (ticks, timeouts,
    etc) it is easier and much more efficient to use Handler.</p>
  </blockquote>
  
  <p>So I'm a bit confused, how should I do this to guarantee correct execution?</p>