For the More Curious: Sync Adapters

Yet another way to set up a regularly polling web service is to use a sync adapter. Sync adapters are not adapters like you have seen before. Instead, their sole purpose is to sync data with a data source (uploading, downloading, or both). Unlike JobScheduler, sync adapters have been around for a while, so you do not have to worry about which version of Android you are running on.

Like JobScheduler, sync adapters can be used as a replacement for the AlarmManager setup that you had in PhotoGallery. Syncs from multiple applications are grouped together by default, without you having to set flags a certain way. Furthermore, you do not have to worry about resetting the sync alarm across reboots because ...

Get Android Programming: The Big Nerd Ranch Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.