From the course: Concurrent Programming with Android: Threads, Workers, and Kotlin Coroutines
Unlock this course with a free trial
Join today to access over 23,200 courses taught by industry experts.
Upgrade IntentService to JobIntentService
From the course: Concurrent Programming with Android: Threads, Workers, and Kotlin Coroutines
Upgrade IntentService to JobIntentService
- I previously described how to use intent service to manage a long running task in its own thread. But that class is being deprecated in Android R or 11. Instead, Google recommends using a newer class named job intent service. Before I get into the coding, here's a bit of background. In API 21, that's Android eight or Oreo. Android introduced a new tool named JobScheduler for scheduling various kinds of jobs that could be executed in an app's own process. Significantly. Jobs scheduled with this tool are deferrable. If a device is dozing, or it's too busy, jobs can be delayed until the appropriate resources become available. The downside of JobScheduler is that it's part of the core Android SDK, and isn't back ported to older versions of Android. But if you want the advantages of Job Scheduler, but the ease of programming offered by intense service, you can instead use the newer class Job intent service. This class does…
Contents
-
-
-
-
-
-
(Locked)
Run background tasks with IntentService5m 22s
-
(Locked)
Upgrade IntentService to JobIntentService4m 37s
-
(Locked)
Send results from JobIntentService to the UI7m 25s
-
(Locked)
Manage deferrable tasks with WorkManager5m 35s
-
(Locked)
Set work request constraints3m 9s
-
(Locked)
Get results from a background worker4m 56s
-
(Locked)
Send progress updates from a background worker5m 2s
-
(Locked)
-
-