问题描述
不包括JobScheduler
仅支持API> 21的事实-JobSchedulers
是否旨在完全替代SyncAdapters
?还是SyncAdapter
包含JobScheduler
缺少的任何功能?
Excluding the fact that JobScheduler
only supports API > 21 - are JobSchedulers
designed to fully replace SyncAdapters
? Or does SyncAdapter
contain any functionality lacking by JobScheduler
?
我的用例是每两个小时同步一次RSS feed.这可以通过JobScheduler完成-是吗?
My use case is syncing an RSS feed every couple of hours. This is doable with a JobScheduler - right?
推荐答案
我会说JobScheduler
不能直接替代SyncAdapter
,它具有更专门的用途(在设备和服务器之间传输数据) .另一方面,JobScheduler
用于安排将来某个时间要执行的任务-就像 AlarmManager
-但潜力更大.
I would say JobScheduler
is not a direct substitution for SyncAdapter
, which has a much more specialized purpose (transferring data between the device and a server). JobScheduler
, on the other hand, serves to schedule tasks to be executed at some point of time in future - just like AlarmManager
- but with a broader potential.
顺便说一句,尝试向后移植 JobScheduler
.
这篇关于SyncAdapter与JobScheduler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!