I am newbie with android and I want to perform task only on some conditions.
I have read about Job Scheduler
and see the tutorial by the Vogella.In that the mention Job Scheduler introduced in API 21. I have searched for what are the similar options that can be used for API < 21
and found the gcmNetworkManager
but that will works on connection related or network related tasks. I just want to use with some functional conditions like on Incoming Call
.Is there any way to do that without using Services
?

- 127
- 2
- 16
2 Answers
The Scheduled tasks the way you described it matches the exact available features of the FireBase Job Dispatcher, which is a collection of classes and frameworks that provide backward compatibility.
You can use Firebase job dispatcher to create background tasks on API Level 14 and Above that has Google Play services installed.
In this case, making use of Firebase you can perform what you need on API < 21. Also, another uses already asked this question.
And you can find more details here

- 73
- 1
- 7
-
Firebase Job Dispatcher appears to have min API of 14: https://github.com/firebase/firebase-jobdispatcher-android#comparison-to-other-libraries although other parts of the documentation state API 9. – Morrison Chang Mar 03 '18 at 04:30
You can use the Evernote android-job library. It provides a simple wrapper around the Android platform frameworks for scheduling jobs.
There are several different choices available on Android (on different API levels) that provide job scheduling capabilites, like, JobScheduler
starting API 21, AlarmManager
which is present from API 1 but underwent major revisions in API 16 and API 23 (not sure about the API versions, but it did underwent major revisions).
So, it's best to use a wrapper library like Evernote android-jobs, if you are supporting wide ranges of API levels and want a consistent behavior across the range.

- 8,677
- 2
- 22
- 35