From the course: Android Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Run background tasks in intent services

Run background tasks in intent services - Android Tutorial

From the course: Android Development Tips

Run background tasks in intent services

- [Instructor] There are a number of different ways to run background tasks in Android using the async task class, threads, and other approaches, but one of the best is the intent service, a service that's designed to run one time to completion and then exit automatically. Android Studio has a template that lets you create an intent service very quickly and use it very simply but it takes a little bit of explanation. In this application, I'm going to go to the project window and right click on the app module, and select new, service, and then I'll select the second option labeled intent service, and I'll accept the name my intent service, and leave the option to include helper start methods selected. I'll finish and that creates a new class and I'll accept the option to add the file to my git repository. And here's my new class. Let's walk through it. First of all, the class extends the intent service class. This is a part of the core Android SDK. There are a number of private fields…

Contents