From the course: Concurrent Programming with Android: Threads, Workers, and Kotlin Coroutines
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Run background tasks with IntentService
From the course: Concurrent Programming with Android: Threads, Workers, and Kotlin Coroutines
Run background tasks with IntentService
- [Instructor] So far in this course, I've described the use of threads and Coroutines to run code concurrently. Those work really well for shorter tasks, tasks that you can run in the context of an activity, a fragment, or a view model. But when you need to run longer operations say, downloading large amounts of content over the web, you'll want to put that sort of code in separate architectures and there are a number of different options available. I'm going to start with a class named and IntentService. This is a special kind of service that's launched by calling a start service function and passing an intent object. The magic of an IntentService is that it runs in its own background thread, so you don't need to do anything special to create a background thread. It's already happening. I'm going to start showing off the classic or legacy IntentService class. It's important to know from the beginning though, that…
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)
-
-