Using the JobScheduler, I set up a simple JobService as follows:
@TargetApi(21)
public class SimpleJobService extends JobService {
private static final S
A periodic job has an implicit deadline of the end of the period as seen in the source code.
Just like explicitly setting a deadline, this gives you an opportunity to decide on how best to handle extended periods of time (you'll note there is a minimum interval, queryable on Android 7.0+ devices with getMinPeriodMillis()) when your conditions are not met. For example, if your constraints are hard requirements, you can call jobFinished(jobParameters, false)
to wait for the next periodic end point or the conditions to be true.