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.

Create and run a bound service

Create and run a bound service

- [Instructor] I've previously described one kind of service, the intent service that's designed to run finite tasks in the background. There are other kinds of services though. The base service class is also designed for longer running tasks. Like an intent service, it runs in the same process as the activity that calls it but it started directly from the activity rather than by sending an intent somewhere and as a result, you can call a simple services functions directly and it can pass values back. Services like this are useful when you have multiple operations you want to run in a non visual context but unlike the intent service, this kind of service doesn't run in the background thread automatically. If you want to execute background operations, such as making network requests, you can once again use threads or co-routines, but within the service. To create a new service class, I'll go to the app module,…

Contents