JobWorkItem
class JobWorkItem : Parcelable
kotlin.Any | |
↳ | android.app.job.JobWorkItem |
A unit of work that can be enqueued for a job using JobScheduler.enqueue
. See JobParameters.dequeueWork
for more details.
Note: Prior to Android version android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE
, JobWorkItems could not be persisted. Apps were not allowed to enqueue JobWorkItems with persisted jobs and the system would throw an IllegalArgumentException
if they attempted to do so. Starting with android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE
, JobWorkItems can be persisted alongside the hosting job. However, Intents cannot be persisted. Set a PersistableBundle
using Builder.setExtras(PersistableBundle)
for any information that needs to be persisted.
Summary
Nested classes | |
---|---|
Builder class for constructing |
Inherited constants | |
---|---|
Public constructors | |
---|---|
JobWorkItem(intent: Intent!) Create a new piece of work, which can be submitted to |
|
JobWorkItem(intent: Intent!, downloadBytes: Long, uploadBytes: Long) Create a new piece of work, which can be submitted to |
|
JobWorkItem(intent: Intent?, downloadBytes: Long, uploadBytes: Long, minimumChunkBytes: Long) Create a new piece of work, which can be submitted to |
Public methods | |
---|---|
Int | |
Int |
Return the count of the number of times this work item has been delivered to the job. |
Long |
Return the estimated size of download traffic that will be performed by this job, in bytes. |
Long |
Return the estimated size of upload traffic that will be performed by this job work item, in bytes. |
PersistableBundle |
Return the extras associated with this work. |
Intent! |
Return the Intent associated with this work. |
Long |
Return the smallest piece of data that cannot be easily paused and resumed, in bytes. |
String |
toString() |
Unit |
writeToParcel(out: Parcel, flags: Int) |
Properties | |
---|---|
static Parcelable.Creator<JobWorkItem!> |
Public constructors
JobWorkItem
JobWorkItem(intent: Intent!)
Create a new piece of work, which can be submitted to JobScheduler.enqueue
.
Intents cannot be used for persisted JobWorkItems. Use Builder.setExtras(PersistableBundle)
instead for persisted JobWorkItems.
Parameters | |
---|---|
intent |
Intent!: The general Intent describing this work. |
JobWorkItem
JobWorkItem(
intent: Intent!,
downloadBytes: Long,
uploadBytes: Long)
Create a new piece of work, which can be submitted to JobScheduler.enqueue
.
See JobInfo.Builder.setEstimatedNetworkBytes(long, long)
for details about how to estimate network traffic.
Intents cannot be used for persisted JobWorkItems. Use Builder.setExtras(PersistableBundle)
instead for persisted JobWorkItems.
Parameters | |
---|---|
intent |
Intent!: The general Intent describing this work. |
downloadBytes |
Long: The estimated size of network traffic that will be downloaded by this job work item, in bytes. Value is a non-negative number of bytes. |
uploadBytes |
Long: The estimated size of network traffic that will be uploaded by this job work item, in bytes. Value is a non-negative number of bytes. |
JobWorkItem
JobWorkItem(
intent: Intent?,
downloadBytes: Long,
uploadBytes: Long,
minimumChunkBytes: Long)
Create a new piece of work, which can be submitted to JobScheduler.enqueue
.
See JobInfo.Builder.setEstimatedNetworkBytes(long, long)
for details about how to estimate network traffic.
Intents cannot be used for persisted JobWorkItems. Use Builder.setExtras(PersistableBundle)
instead for persisted JobWorkItems.
Parameters | |
---|---|
intent |
Intent?: The general Intent describing this work. This value may be null . |
downloadBytes |
Long: The estimated size of network traffic that will be downloaded by this job work item, in bytes. Value is a non-negative number of bytes. |
uploadBytes |
Long: The estimated size of network traffic that will be uploaded by this job work item, in bytes. Value is a non-negative number of bytes. |
minimumChunkBytes |
Long: The smallest piece of data that cannot be easily paused and resumed, in bytes. Value is a non-negative number of bytes. |
Public methods
describeContents
fun describeContents(): Int
Return | |
---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
getDeliveryCount
fun getDeliveryCount(): Int
Return the count of the number of times this work item has been delivered to the job. The value will be > 1 if it has been redelivered because the job was stopped or crashed while it had previously been delivered but before the job had called JobParameters.completeWork
for it.
getEstimatedNetworkDownloadBytes
fun getEstimatedNetworkDownloadBytes(): Long
Return the estimated size of download traffic that will be performed by this job, in bytes.
Value is a non-negative number of bytes.
Return | |
---|---|
Long |
Estimated size of download traffic, or JobInfo.NETWORK_BYTES_UNKNOWN when unknown. Value is a non-negative number of bytes. |
getEstimatedNetworkUploadBytes
fun getEstimatedNetworkUploadBytes(): Long
Return the estimated size of upload traffic that will be performed by this job work item, in bytes.
Value is a non-negative number of bytes.
Return | |
---|---|
Long |
Estimated size of upload traffic, or JobInfo.NETWORK_BYTES_UNKNOWN when unknown. Value is a non-negative number of bytes. |
getExtras
fun getExtras(): PersistableBundle
Return the extras associated with this work.
Return | |
---|---|
PersistableBundle |
This value cannot be null . |
getIntent
fun getIntent(): Intent!
Return the Intent associated with this work.
getMinimumNetworkChunkBytes
fun getMinimumNetworkChunkBytes(): Long
Return the smallest piece of data that cannot be easily paused and resumed, in bytes.
Value is a non-negative number of bytes.
Return | |
---|---|
Long |
Smallest piece of data that cannot be easily paused and resumed, or JobInfo.NETWORK_BYTES_UNKNOWN when unknown. Value is a non-negative number of bytes. |
toString
fun toString(): String
Return | |
---|---|
String |
a string representation of the object. |
writeToParcel
fun writeToParcel(
out: Parcel,
flags: Int
): Unit
Parameters | |
---|---|
dest |
The Parcel in which the object should be written. This value cannot be null . |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |