4

I am making an app which will need to schedule job days or months in future. And for the purpose I am Planning on using the android Job Scheduler but after looking at the android.app.job I have learnt that for my task I will need to use the setOverrideDeadline meathod which takes the long(millis) as an input argument this can give me a maximum for 11.5 days period now what I can do is use the perodic function which will check every day or week and if the desired task is due that week it will schedule a job using setOverrideDeadline. Now this can work but I will like to ask pros if this is the right way to do it.

Regards and Thanks for help.

Ref : http://developer.android.com/reference/android/app/job/JobScheduler.html Ref : http://developer.android.com/reference/android/app/job/package-summary.html

Hassan Niazi
  • 330
  • 2
  • 3
  • 13
  • [Be aware that Jobs are subject to Doze restrictions in Android 6.0.](http://developer.android.com/training/monitoring-device-state/doze-standby.html) – sonictt1 Dec 10 '15 at 05:49
  • I think that wont be any problem because it will deffer the task and my task are not that much time critical and it will be ok if the task executes even 8 hours later. The thing is that it should not be delayed more than a day. Plz correct me if I am wrong also plz comment on my above method if I am doing it the right way. @sonictt1 – Hassan Niazi Dec 10 '15 at 05:59
  • There are 1000 milliseconds in a second. A long (8 byte) integer supports a time span much longer than 11.5 days. – Bob Snyder Dec 10 '15 at 06:10
  • Right ! But the maximum value which this method takes is builder.setOverrideDeadline(999999999); – Hassan Niazi Dec 10 '15 at 07:40
  • After that it says integer number too large. – Hassan Niazi Dec 10 '15 at 07:41
  • @qbix Thanks ! I was not adding L at the end of the number so it was taking it as a int. – Hassan Niazi Dec 10 '15 at 07:46

0 Answers0