san*_*oli 9 android firebase firebase-job-dispatcher custom-rom
我有一项需要执行互联网的任务,必须每天无限期执行,下面是我为执行相同操作而编写的代码
FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(this));
Job myJob = dispatcher.newJobBuilder()
.setService(FirebaseJobDispatcherService.class) // the JobService that will be called
.setTag(Constants.ALERT_TAG) // uniquely identifies the job
.setRecurring(true)
.setLifetime(Lifetime.FOREVER)
.setReplaceCurrent(true)
.setRetryStrategy(RetryStrategy.DEFAULT_LINEAR)
.setTrigger(Trigger.executionWindow(0, (int) TimeUnit.DAYS.toSeconds(1)))
.setConstraints(Constraint.ON_ANY_NETWORK)
.build();
dispatcher.mustSchedule(myJob);
Run Code Online (Sandbox Code Playgroud)
现在的问题是,它可以在像Moto,三星等普通设备上正常工作,但在像OnePlus这样的自定义ROM上,小米只有在应用程序打开时才会触发作业.有没有人遇到这个问题或者知道如何使它在自定义ROM上正常工作?
| 归档时间: |
|
| 查看次数: |
457 次 |
| 最近记录: |