public interface JobCreator
JobCreator
maps a tag to a specific Job
class. You need to pass the tag in the
JobRequest.Builder
constructor.
JobManager
can have multiple JobCreator
s with a first come first serve principle.
That means that a JobCreator
can block others from creating the right Job
, if they
share the same tag.Modifier and Type | Interface and Description |
---|---|
static class |
JobCreator.AddJobCreatorReceiver
Abstract receiver to get notified about when
JobCreator s need to be added. |
Modifier and Type | Field and Description |
---|---|
static String |
ACTION_ADD_JOB_CREATOR
Action to notify receives that the application was instantiated and
JobCreator s should be added. |
Modifier and Type | Method and Description |
---|---|
Job |
create(String tag)
Map the
tag to a Job . |
static final String ACTION_ADD_JOB_CREATOR
JobCreator
s should be added.@Nullable Job create(@NonNull String tag)
tag
to a Job
. If you return null
, then other JobCreator
s
get the chance to create a Job
for this tag. If no job is created at all, then it's assumed
that job failed. This method is called on a background thread right before the job runs.tag
- The tag from the JobRequest
which you passed in the constructor of the
JobRequest.Builder
class.Job
instance for this tag. If you return null
, then the job failed
and isn't rescheduled.JobRequest.Builder#Builder(String)