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
?
My use case is syncing an RSS feed every couple of hours. This is doable with a JobScheduler - right?
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.
By the way, there's an attempt to backport JobScheduler
.
SyncAdapter
The framework continues to provide the SyncAdapter class for managing tasks that sync data between the device and a server. Sync adapters are designed specifically for syncing data between a device and the cloud; you should only use them for this type of task. Sync adapters are more complex to implement than the libraries and APIs mentioned above, because they require at least a fake authenticator and content provider implementation. For these reasons, you typically should not create a sync adapter just to sync data to the cloud in the background. Wherever possible, you should instead use JobScheduler, Firebase JobDispatcher, or GCM Network Manager .
In Android N (API level 24), the SyncManager sits on top of the JobScheduler. You should only use the SyncAdapter class if you require the additional functionality that it provides.
https://developer.android.com/topic/performance/scheduling.html