Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Job Scheduler in Android API <21

I was looking at a scheduling tutorial by Vogella. It mentions the Job Scheduler API that was introduced in API 21 of Android. My question is can it be implemented in APIs lower than 21 (Lollipop) but not less than Android version 3 (Honeycomb)?

like image 866
Manny265 Avatar asked Feb 17 '15 14:02

Manny265


People also ask

Which API is used to schedule Android jobs?

The job scheduler API. The Android 5.0 Lollipop (API 21) release introduces a job scheduler API via the JobScheduler class. This API allows to batch jobs when the device has more resources available.

What is the difference between job scheduler and WorkManager in Android?

As mentioned in the previous section, WorkManager internally uses the JobScheduler API on Android 6.0 (API Level 23 – Marshmallow) and above devices. Therefore, there won't be any major differences between the WorkManager and JobScheduler on Android 6.0 and above devices.

How does job scheduler work in Android?

JobScheduler is introduced while the Android set limitation on background Execution. It means that the system will automatically destroy the background execution to save battery and memory. So if you want to perform some background job like some network operations no matter your app is running or not.


1 Answers

from now on (after I/O 2015), you can also use new GcmNetworkManager. How to use it and how it works is described here - https://developers.google.com/cloud-messaging/network-manager

It does a lot cool stuff like it persists your tasks trough reboots. On Lolipop it uses JobScheduler, on pre-Lolipop it uses it's own implementation.

EDIT:

An example code on how to use it : https://github.com/jacktech24/gcmnetworkmanager-android-example

like image 183
filipproch Avatar answered Sep 25 '22 20:09

filipproch