api 级别 26 及以上的长时间后台服务任务的解决方案是什么?

What is solution for long background Service Task with api level 26 and above?

我有后台长运行任务服务, 从开发者网站我发现了一些像 "If your app targets API level 26 or higher, the system imposes restrictions on running background services when the app itself is not in the foreground. In most cases like this, your app should use a scheduled job instead. " 这样的词 https://developer.android.com/topic/performance/scheduling.html 如何将服务替换为调度任务? 这会在后台持续工作吗?

首选方法是使用 Android Job Scheduler or Firebase Job Dispatcher。但是,您不能 运行 长时间执行任务,但您可以 运行 在特定时间间隔后的短时间内执行任务。