in Android by
What is a JobScheduler?

1 Answer

0 votes
by

The JobScheduler API performs an operation for your application when a set of predefined conditions are met (such as when a device is plugged into a power source or connected to a Wi-Fi network). This allows your app to perform the given task while being considerate of the device's battery at the cost of timing control.

Unlike the AlarmManager class, the timing isn't exact. Compared to a custom SyncAdapter or the AlarmManager, the JobScheduler supports batch scheduling of jobs. The Android system can combine jobs so that battery consumption is reduced. JobManager makes handling uploads easier as it handles automatically the unreliability of the network. It also survives application restarts. Here are example when you would use this job scheduler:

  • Tasks that should be done once the device is connect to a power supply
  • Tasks that require network access or a Wi-Fi connection.
  • Task that are not critical or user facing
  • Tasks that should be running on a regular basis as batch where the timing is not critical
...