我正在使用 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、小米设备(我已经请求允许在自动启动中启用应用程序)。但是,我在 One Plus 设备上安排它时遇到了问题(作业服务启动了一段时间,然后突然停止。)