title: Android-Job run every time device is plugged in
body: <p>In my Android app I need to run a background service every time the device is plugged in and idle (it should start after the user connects his device to the charger and end when he disconnects it).</p>
  
  <p>What I want is a similar thing to listening for the ACTION_POWER_CONNECTED broadcast, but targeting Oreo this broadcast doesn't get sent.</p>
  
  <p>I tried Android-Job from Evernote because it doesn't require Google Play Services, as Firebase JobDispatcher does.</p>
  
  <pre><code> new JobRequest.Builder(DemoSyncJob.TAG)
              .setRequiresCharging(true)
              .setRequiresDeviceIdle(true)
              .build()
              .schedule();
  </code></pre>
  
  <p>The problem is that I don't want to have to schedule the job every time. Instead, I want to schedule the job once and have it run every time the user connects his device to the charger.</p>
  
  <p>How can it be done?
  Thank you.</p>