What is JobService in Android?

I check the latest samples in the Android-L SDK of the developer. There android-L/ui/views/Clipping/ClippingBasicis an example class called TestJobService . It is distributed from JobService , which, in turn, is distributed from Service . I see that JobService is a class in android.jar, but I can not find any information about this either in the developer guides or in the Android source code www.androidxref.com . Has anyone seen this class or knows what its purpose is?

+5
source share
3 answers

This is a new type of service that is called for tasks that are planned to be launched depending on system conditions (for example, it is idle, connected).

Entry point for callback from JobScheduler.

This is a base class that handles asynchronous requests that were previously planned. You are responsible for overriding onStartJob(JobParameters)where you will do your logic work.

You basically create an object JobInfothat describes these conditions (using JobInfo.Builder) and sets the name of the service component that should be executed.

To plan them, you will need JobSchedulerwith whom you can access with Context.getSystemService(Context.JOB_SCHEDULER_SERVICE).

By the way, L Preview Documentation is here if you did not know about it.

UPDATE: JobService: https://developer.android.com/reference/android/app/job/JobService.html

+6

Source: https://habr.com/ru/post/1547432/


All Articles