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.

Execute tasks with JobScheduler

Execute tasks with JobScheduler - Android Tutorial

From the course: Android Development Tips

Execute tasks with JobScheduler

- [Instructor] The JobScheduler API was introduced in Android 5.0, Lollipop. It lets you send requests for processing jobs in a service, but it lets the application framework decide exactly when the job will be executed. There are many reasons to use the JobScheduler API, specifically, in Oreo, Android 8, where there were new constraints on what you can do in background services. The job schedule lets you avoid creating long-running services, and instead lets the application framework choose good times to do background tasks. The first step is to create a service. In this application space package, I'll create a new package, that I'll name services, and then, within that new package, I'll create a new Java class. I'll name this service MyJobService, and then I'll set the superclass as JobService from the android.app.job package. I'll create that service class, and I'll see that there's a warning indicator on the class declaration. I'll use an intention action and choose implement…

Contents