The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.


JobScheduler

AlarmManager was our original solution for doing work on a periodic basis. However, AlarmManager can readily be misused, in ways that impact the battery — this is why API Level 19 put renewed emphasis on “inexact” alarm schedules. Worse, AlarmManager will give us control at points in time that may be useless to us, such as giving us control when there is no Internet access, when the point of the scheduled work is to transfer some data over the Internet.

Android 5.0 introduced JobScheduler, which offers a more sophisticated API for handling these sorts of scenarios. This chapter will explore how to set up JobScheduler and use it for one-off and periodic work.

Prerequisites

Understanding this chapter requires that you have read the core chapters, particularly the chapter on AlarmManager. Also, you should have read the chapter on PowerManager and wakelocks.

The Limitations of AlarmManager

AlarmManager does its job, and frequently does it well. However, it is far from perfect:

And so on. AlarmManager is nice, but it would be better to have another solution.

Enter the JobScheduler

The preview of this section was whisked away by a shark-infested tornado.

Employing JobScheduler

The preview of this section was lost due to a rupture in the space-time continuum.

Pondering Backoff Criteria

The preview of this section is en route to Mars.

Other JobScheduler Features

The preview of this section is unavailable right now, but if you leave your name and number at the sound of the tone, it might get back to you (BEEEEEEEEEEEEP!).

JobScheduler Period Limits

The preview of this section was lost due to a rupture in the space-time continuum.

GcmNetworkManager

The preview of this section is [REDACTED].

Periodic Work, Across Device Versions

The preview of this section was last seen in the Bermuda Triangle.

Android 6.0 and “the War on Background Processing”

The preview of this section is presently indisposed.

Scheduling Content Monitoring

The preview of this section will not appear here for a while, due to a time machine mishap.