use of com.evernote.android.job.JobProxyIllegalStateException in project android-job by evernote.
the class JobProxyWorkManager method plantPeriodic.
@Override
public void plantPeriodic(JobRequest request) {
PeriodicWorkRequest workRequest = new PeriodicWorkRequest.Builder(PlatformWorker.class, request.getIntervalMs(), TimeUnit.MILLISECONDS, request.getFlexMs(), TimeUnit.MILLISECONDS).setConstraints(buildConstraints(request)).addTag(createTag(request.getJobId())).build();
WorkManager workManager = getWorkManager();
if (workManager == null) {
throw new JobProxyIllegalStateException("WorkManager is null");
}
workManager.enqueue(workRequest);
}
use of com.evernote.android.job.JobProxyIllegalStateException in project android-job by evernote.
the class JobProxyWorkManager method plantOneOff.
@Override
public void plantOneOff(JobRequest request) {
if (request.isTransient()) {
TransientBundleHolder.putBundle(request.getJobId(), request.getTransientExtras());
}
OneTimeWorkRequest workRequest = new OneTimeWorkRequest.Builder(PlatformWorker.class).setInitialDelay(request.getStartMs(), // don't use the average here, WorkManager will do the right thing
TimeUnit.MILLISECONDS).setConstraints(buildConstraints(request)).addTag(createTag(request.getJobId())).build();
// don't set the back-off criteria, android-job is handling this
WorkManager workManager = getWorkManager();
if (workManager == null) {
throw new JobProxyIllegalStateException("WorkManager is null");
}
workManager.enqueue(workRequest);
}
Aggregations