我正在使用Firebase Job Dispatcher来安排作业
Driver driver = new GooglePlayDriver(context);
FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(driver);
Job pedometerReminderJob = dispatcher.newJobBuilder()
.setService(PedometerService.class)
.setTag(PEDOMETER_JOB_TAG)
.setLifetime(Lifetime.FOREVER)
.setRecurring(true)
.setTrigger(Trigger.executionWindow(0,60))
.setReplaceCurrent(true)
.build();
dispatcher.schedule(pedometerReminderJob);
我已经检查了一些设备,例如nexus 6p,三星galaxy s7,Xiomi设备(我已经请求允许在自动启动时启用该应用程序)。但是,我面临着在One Plus设备上安排它的问题(工作服务开始了一段时间但突然停止了。)