0

need some help to set up my perodic job correctly with android-job lib.

I want to start a job once a day and the device is ideling. Additionally the job should start as soon as possible on day. That means in best way the job start at 00:01 AM.

And it's not that solution descriped here!

Is this possible? Can anyone give me a hint for the rigth solution?

Here is my code snippset for a Job once a day if device is idle

        mJobId = new JobRequest.Builder(JOBTAG)
            .setPeriodic(TimeUnit.HOURS.toMillis(24))
            .setPersisted(true)
            .setUpdateCurrent(true)
            .setRequiresCharging(false)
            .setRequiresDeviceIdle(true)
            .setRequiredNetworkType(JobRequest.NetworkType.CONNECTED)
            .build()
            .schedule();
Scrounger
  • 261
  • 3
  • 5

1 Answers1

0

The linked helper works, you only need to adjust it to your use case.

Note that version 1.2.0 will contain a helper class, which should make this easier for you.

vRallev
  • 4,982
  • 3
  • 31
  • 34