how do i ensure that a service is running even if the phone is on standby?
<p>I have a service that spawns a thread which runs a task every 3 seconds.</p>

<pre><code>class MyService extends Service {
  private Timer timer = new Timer();

  public int onStartCommand(Intent intent, int flags, int startId) {
    TimerTask task = new TimerTask() {
      public void run() {
        // something important
      }
    };

    timer.scheduleAtFixedRate(task, 0, 3000);
    return Service.START_STICKY;
  }
  ...
}
</code></pre>

<p>My service runs fine when my phone is on, but when my phone is on standby, the service is often not responding.</p>

<p>Any clues as to how I can ensure my service is running while on standby?</p>
