我每天创造就业机会。
Driver driver = new GooglePlayDriver(this);
FirebaseJobDispatcher firebaseJobDispatcher = new FirebaseJobDispatcher(driver);
final int periodicity = (int) TimeUnit.DAYS.toSeconds(1);
final int toleranceInterval = (int) TimeUnit.HOURS.toSeconds(1);
Job chatBackupJob = firebaseJobDispatcher.newJobBuilder()
.setService(MyJobService.class)
.setTag(MyJobService.SERVICE_TAG)
.setConstraints(Constraint.ON_ANY_NETWORK)
.setLifetime(Lifetime.FOREVER)
.setRecurring(true)
.setTrigger(Trigger.executionWindow(periodicity, periodicity + toleranceInterval))
.setReplaceCurrent(false)
.setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
.build();
firebaseJobDispatcher.mustSchedule(chatBackupJob);
如何测试此代码? 我想测试与AlarmManager相同,如果我们在触发报警管理器时更改时间,但不会触发JobScheduler。 我想确保每天(或给定时间间隔)来自我这边的工作电话? 请给我一些建议