title: Firebase Job Dispatcher
body: <p>I'm creating an application which needs to send a request to an API. This request has to be send every 2 minutes. To do this I'm using Firebase Job Dispatcher</p>
  
  <p>The problem is that the first request is send at time but the next ones are sent with a greater delay: eg. </p>
  
  <ul>
  <li>first request: sent after 2 minutes</li>
  <li>second request: sent after 2.3 minutes (instead of two)</li>
  <li>third request: sent after 3.5 minutes (instead of two)</li>
  <li>fourth request: sent after 5 minutes (instead of two)</li>
  </ul>
  
  <p>As you can imagine, after a day, the delay will be 30 minutes or even more...</p>
  
  <p>here is the code I used to create the job (in main activity - onCreate)</p>
  
  <pre><code>        Job pingJob = mDispatcher.newJobBuilder()
              .setService(PingJob.class) // the job class to execute
              .setTag(PingJob.TAG) //tag - name of the job
              .setRecurring(true) // repeat
              .setTrigger(Trigger.executionWindow(60, 60*2))
              .setReplaceCurrent(false)
              .build();
  
      mDispatcher.mustSchedule(pingJob);
  </code></pre>
  
  <p>Here is the PingJob class (to be sure the issue wasn't what i was doing in onStartJob, I only put a log):</p>
  
  <pre><code>public class PingJob extends Job {
      public static final String TAG = "ping_job";
  
      @Override
      public boolean onStartJob(final JobParameters params) {
          Log.d("ping job", "just put a log to see when is executed");
          jobFinished(params, true);
          return true;
      }
  
      @Override
      public boolean onStopJob(JobParameters params) {
          return false;
      }
  
  }
  </code></pre>
  
  <p>I'm using an Android box with Android 6.0.1 (but my application has to run on 4.3 device too that why I'm using firebase instead of JobScheduler) and Google Play services 11.5.09 (434).</p>
  
  <p>Do you have any ideas why it's doing this ? and if there is a way to get around this problem ? if not, is there a other way to do a job every 2 minutes ?</p>