/** * Change the back-off policy for a non periodic job. The default value is set to 30 seconds * and {@link BackoffPolicy#EXPONENTIAL}. The time is increasing each time a job fails and * returns {@link Job.Result#RESCHEDULE}, but capped at 5 hours. * * <br> * <br> * * Note that it's not allowed to change the back-off criteria for a periodic job. * * @param backoffMs The initial interval to wait when the job has been rescheduled. * @param backoffPolicy Is either {@link BackoffPolicy#LINEAR} or {@link BackoffPolicy#EXPONENTIAL}. * @see Job.Result#RESCHEDULE * @see Job#onReschedule(int) */ public Builder setBackoffCriteria(long backoffMs, @NonNull BackoffPolicy backoffPolicy) { mBackoffMs = JobPreconditions.checkArgumentPositive(backoffMs, "backoffMs must be > 0"); mBackoffPolicy = JobPreconditions.checkNotNull(backoffPolicy); return this; }
mStartMs = JobPreconditions.checkArgumentPositive(startInMs, "startInMs must be greater than 0"); mEndMs = JobPreconditions.checkArgumentInRange(endInMs, startInMs, Long.MAX_VALUE, "endInMs");
JobPreconditions.checkArgumentPositive(mBackoffMs, "backoffMs must be > 0"); JobPreconditions.checkNotNull(mBackoffPolicy); JobPreconditions.checkNotNull(mNetworkType);
/** * Change the back-off policy for a non periodic job. The default value is set to 30 seconds * and {@link BackoffPolicy#EXPONENTIAL}. The time is increasing each time a job fails and * returns {@link Job.Result#RESCHEDULE}, but capped at 5 hours. * * <br> * <br> * * Note that it's not allowed to change the back-off criteria for a periodic job. * * @param backoffMs The initial interval to wait when the job has been rescheduled. * @param backoffPolicy Is either {@link BackoffPolicy#LINEAR} or {@link BackoffPolicy#EXPONENTIAL}. * @see Job.Result#RESCHEDULE * @see Job#onReschedule(int) */ public Builder setBackoffCriteria(long backoffMs, @NonNull BackoffPolicy backoffPolicy) { mBackoffMs = JobPreconditions.checkArgumentPositive(backoffMs, "backoffMs must be > 0"); mBackoffPolicy = JobPreconditions.checkNotNull(backoffPolicy); return this; }
mStartMs = JobPreconditions.checkArgumentPositive(startInMs, "startInMs must be greater than 0"); mEndMs = JobPreconditions.checkArgumentInRange(endInMs, startInMs, Long.MAX_VALUE, "endInMs");
JobPreconditions.checkArgumentPositive(mBackoffMs, "backoffMs must be > 0"); JobPreconditions.checkNotNull(mBackoffPolicy); JobPreconditions.checkNotNull(mNetworkType);