Batching and Job Schedulers

In this section, we will discuss scheduling jobs which are not required to be completed immediately, but can be done later when more resources are available.

Currently, Android has two APIs with which we can schedule jobs:

  • AlarmManager API
  • JobScheduler API

In AlarmManager API, we can schedule a task to be done by the system at a given time in the future.

The AlarmManager requires a broadcast receiver to capture the task and perform the required action. We can also schedule repetitive jobs which are to be performed at certain intervals.

While we are scheduling an alarm, we must pass the type, the time when the alarm is scheduled, and a PendingIntent.

The AlarmManager has two types of alarms:

  • RTC: In this type, ...

Get Expert Android Programming 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.