public class JobParameters extends Object implements Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<JobParameters> |
CREATOR |
static int |
REASON_CANCELED |
static int |
REASON_CONSTRAINTS_NOT_SATISFIED |
static int |
REASON_DEVICE_IDLE |
static int |
REASON_PREEMPT |
static int |
REASON_TIMEOUT |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
JobParameters(IBinder callback,
int jobId,
PersistableBundle extras,
boolean overrideDeadlineExpired,
Uri[] triggeredContentUris,
String[] triggeredContentAuthorities) |
Modifier and Type | Method and Description |
---|---|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
IJobCallback |
getCallback() |
PersistableBundle |
getExtras() |
int |
getJobId() |
int |
getStopReason()
Reason onStopJob() was called on this job.
|
String[] |
getTriggeredContentAuthorities()
For jobs with
JobInfo.Builder.addTriggerContentUri(android.app.job.JobInfo.TriggerContentUri) set, this
reports which content authorities have triggered the job. |
Uri[] |
getTriggeredContentUris()
For jobs with
JobInfo.Builder.addTriggerContentUri(android.app.job.JobInfo.TriggerContentUri) set, this
reports which URIs have triggered the job. |
boolean |
isOverrideDeadlineExpired()
For jobs with
JobInfo.Builder.setOverrideDeadline(long) set, this
provides an easy way to tell whether the job is being executed due to the deadline
expiring. |
void |
setStopReason(int reason) |
void |
writeToParcel(Parcel dest,
int flags)
Flatten this object in to a Parcel.
|
public static final int REASON_CANCELED
public static final int REASON_CONSTRAINTS_NOT_SATISFIED
public static final int REASON_PREEMPT
public static final int REASON_TIMEOUT
public static final int REASON_DEVICE_IDLE
public static final Parcelable.Creator<JobParameters> CREATOR
public JobParameters(IBinder callback, int jobId, PersistableBundle extras, boolean overrideDeadlineExpired, Uri[] triggeredContentUris, String[] triggeredContentAuthorities)
public int getJobId()
public int getStopReason()
public PersistableBundle getExtras()
JobInfo.Builder.setExtras(android.os.PersistableBundle)
. This will
never be null. If you did not set any extras this will be an empty bundle.public boolean isOverrideDeadlineExpired()
JobInfo.Builder.setOverrideDeadline(long)
set, this
provides an easy way to tell whether the job is being executed due to the deadline
expiring. Note: If the job is running because its deadline expired, it implies that its
constraints will not be met.public Uri[] getTriggeredContentUris()
JobInfo.Builder.addTriggerContentUri(android.app.job.JobInfo.TriggerContentUri)
set, this
reports which URIs have triggered the job. This will be null if either no URIs have
triggered it (it went off due to a deadline or other reason), or the number of changed
URIs is too large to report. Whether or not the number of URIs is too large, you can
always use getTriggeredContentAuthorities()
to determine whether the job was
triggered due to any content changes and the authorities they are associated with.public String[] getTriggeredContentAuthorities()
JobInfo.Builder.addTriggerContentUri(android.app.job.JobInfo.TriggerContentUri)
set, this
reports which content authorities have triggered the job. It will only be null if no
authorities have triggered it -- that is, the job executed for some other reason, such
as a deadline expiring. If this is non-null, you can use getTriggeredContentUris()
to retrieve the details of which URIs changed (as long as that has not exceeded the maximum
number it can reported).public IJobCallback getCallback()
public void setStopReason(int reason)
public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel dest, int flags)
Parcelable
writeToParcel
in interface Parcelable
dest
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.