WorkerParameters

public final class WorkerParameters
extends Object

java.lang.Object
   ↳ androidx.work.WorkerParameters


Setup parameters for a ListenableWorker.

Summary

Public methods

UUID getId()

Gets the ID of the WorkRequest that created this ListenableWorker.

Data getInputData()

Gets the input data.

Network getNetwork()

Gets the Network to use for this Worker.

int getRunAttemptCount()

Gets the current run attempt count for this work.

Set<String> getTags()

Gets a Set of tags associated with this Worker's WorkRequest.

List<String> getTriggeredContentAuthorities()

Gets the list of content authorities that caused this Worker to execute.

List<Uri> getTriggeredContentUris()

Gets the list of content Uris that caused this Worker to execute.

Inherited methods

Public methods

getId

public UUID getId ()

Gets the ID of the WorkRequest that created this ListenableWorker.

Returns
UUID The ID of the creating WorkRequest

getInputData

public Data getInputData ()

Gets the input data. Note that in the case that there are multiple prerequisites for this ListenableWorker, the input data has been run through an InputMerger.

Returns
Data The input data for this work

getNetwork

public Network getNetwork ()

Gets the Network to use for this Worker. This method returns null if there is no network needed for this work request.

Returns
Network The Network specified by the OS to be used with this Worker

getRunAttemptCount

public int getRunAttemptCount ()

Gets the current run attempt count for this work. Note that for periodic work, this value gets reset between periods.

Returns
int The current run attempt count for this work.

getTags

public Set<String> getTags ()

Gets a Set of tags associated with this Worker's WorkRequest.

Returns
Set<String> The Set of tags associated with this Worker's WorkRequest

getTriggeredContentAuthorities

public List<String> getTriggeredContentAuthorities ()

Gets the list of content authorities that caused this Worker to execute. See JobParameters#getTriggeredContentAuthorities() for relevant JobScheduler code.

Returns
List<String> The list of content authorities that caused this Worker to execute

getTriggeredContentUris

public List<Uri> getTriggeredContentUris ()

Gets the list of content Uris that caused this Worker to execute. SeeJobParameters#getTriggeredContentUris()} for relevant {@code JobScheduler} code.

Returns
List<Uri> The list of content Uris that caused this Worker to execute