Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/app/job/JobWorkItem#nestedclasses) \| [Inherited Constants](https://developer.android.com/reference/android/app/job/JobWorkItem#inhconstants) \| [Fields](https://developer.android.com/reference/android/app/job/JobWorkItem#lfields) \| [Ctors](https://developer.android.com/reference/android/app/job/JobWorkItem#pubctors) \| [Methods](https://developer.android.com/reference/android/app/job/JobWorkItem#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/job/JobWorkItem#inhmethods)

# JobWorkItem

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/app/job/JobWorkItem "View this page in Kotlin") \|Java


`
public

final

class
JobWorkItem
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/android/os/Parcelable


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.job.JobWorkItem |

<br />

*** ** * ** ***

A unit of work that can be enqueued for a job using
`https://developer.android.com/reference/android/app/job/JobScheduler#enqueue(android.app.job.JobInfo,%20android.app.job.JobWorkItem)`. See
`https://developer.android.com/reference/android/app/job/JobParameters#dequeueWork()` for more details.

**Note:** Prior to Android version
`https://developer.android.com/reference/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 `https://developer.android.com/reference/java/lang/IllegalArgumentException` if they attempted to do so. Starting with
`https://developer.android.com/reference/android/os/Build.VERSION_CODES#UPSIDE_DOWN_CAKE`, JobWorkItems can be persisted alongside
the hosting job. However, Intents cannot be persisted. Set a `https://developer.android.com/reference/android/os/PersistableBundle` using
`https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#setExtras(android.os.PersistableBundle)` for any information that needs to be persisted.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/app/job/JobWorkItem.Builder` Builder class for constructing `https://developer.android.com/reference/android/app/job/JobWorkItem` objects. |

| ### Inherited constants |
|---|
| From interface `https://developer.android.com/reference/android/os/Parcelable` |---|---| | `int` | `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor. | | `int` | `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". | |

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/app/job/JobWorkItem>` | `https://developer.android.com/reference/android/app/job/JobWorkItem#CREATOR` |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/job/JobWorkItem#JobWorkItem(android.content.Intent)(https://developer.android.com/reference/android/content/Intent intent) ` Create a new piece of work, which can be submitted to `https://developer.android.com/reference/android/app/job/JobScheduler#enqueue(android.app.job.JobInfo,%20android.app.job.JobWorkItem)`. |
| ` https://developer.android.com/reference/android/app/job/JobWorkItem#JobWorkItem(android.content.Intent,%20long,%20long)(https://developer.android.com/reference/android/content/Intent intent, long downloadBytes, long uploadBytes) ` Create a new piece of work, which can be submitted to `https://developer.android.com/reference/android/app/job/JobScheduler#enqueue(android.app.job.JobInfo,%20android.app.job.JobWorkItem)`. |
| ` https://developer.android.com/reference/android/app/job/JobWorkItem#JobWorkItem(android.content.Intent,%20long,%20long,%20long)(https://developer.android.com/reference/android/content/Intent intent, long downloadBytes, long uploadBytes, long minimumChunkBytes) ` Create a new piece of work, which can be submitted to `https://developer.android.com/reference/android/app/job/JobScheduler#enqueue(android.app.job.JobInfo,%20android.app.job.JobWorkItem)`. |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/app/job/JobWorkItem#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` int` | ` https://developer.android.com/reference/android/app/job/JobWorkItem#getDeliveryCount()() ` Return the count of the number of times this work item has been delivered to the job. |
| ` long` | ` https://developer.android.com/reference/android/app/job/JobWorkItem#getEstimatedNetworkDownloadBytes()() ` Return the estimated size of download traffic that will be performed by this job, in bytes. |
| ` long` | ` https://developer.android.com/reference/android/app/job/JobWorkItem#getEstimatedNetworkUploadBytes()() ` Return the estimated size of upload traffic that will be performed by this job work item, in bytes. |
| ` https://developer.android.com/reference/android/os/PersistableBundle` | ` https://developer.android.com/reference/android/app/job/JobWorkItem#getExtras()() ` Return the extras associated with this work. |
| ` https://developer.android.com/reference/android/content/Intent` | ` https://developer.android.com/reference/android/app/job/JobWorkItem#getIntent()() ` Return the Intent associated with this work. |
| ` long` | ` https://developer.android.com/reference/android/app/job/JobWorkItem#getMinimumNetworkChunkBytes()() ` Return the smallest piece of data that cannot be easily paused and resumed, in bytes. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/app/job/JobWorkItem#toString()() ` Returns a string representation of the object. |
| ` void` | ` https://developer.android.com/reference/android/app/job/JobWorkItem#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel out, int flags) ` Flatten this object in to a Parcel. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/android/os/Parcelable ` |---|---| | ` abstract int` | ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. | | ` abstract void` | ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. | ||

## Fields

### CREATOR

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Creator<JobWorkItem> CREATOR
```

<br />

<br />

## Public constructors

### JobWorkItem

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public JobWorkItem (Intent intent)
```

Create a new piece of work, which can be submitted to
`https://developer.android.com/reference/android/app/job/JobScheduler#enqueue(android.app.job.JobInfo,%20android.app.job.JobWorkItem)`.


Intents cannot be used for persisted JobWorkItems.
Use `https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#setExtras(android.os.PersistableBundle)` instead for persisted JobWorkItems.

<br />

| Parameters ||
|---|---|
| `intent` | `Intent`: The general Intent describing this work. <br /> |

### JobWorkItem

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public JobWorkItem (Intent intent, 
                long downloadBytes, 
                long uploadBytes)
```

Create a new piece of work, which can be submitted to
`https://developer.android.com/reference/android/app/job/JobScheduler#enqueue(android.app.job.JobInfo,%20android.app.job.JobWorkItem)`.


See `https://developer.android.com/reference/android/app/job/JobInfo.Builder#setEstimatedNetworkBytes(long,%20long)` for
details about how to estimate network traffic.


Intents cannot be used for persisted JobWorkItems.
Use `https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#setExtras(android.os.PersistableBundle)` instead for persisted JobWorkItems.

<br />

| Parameters ||
|---|---|
| `intent` | `Intent`: The general Intent describing this work. <br /> |
| `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. <br /> |
| `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. <br /> |

### JobWorkItem

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public JobWorkItem (Intent intent, 
                long downloadBytes, 
                long uploadBytes, 
                long minimumChunkBytes)
```

Create a new piece of work, which can be submitted to
`https://developer.android.com/reference/android/app/job/JobScheduler#enqueue(android.app.job.JobInfo,%20android.app.job.JobWorkItem)`.


See `https://developer.android.com/reference/android/app/job/JobInfo.Builder#setEstimatedNetworkBytes(long,%20long)` for
details about how to estimate network traffic.


Intents cannot be used for persisted JobWorkItems.
Use `https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#setExtras(android.os.PersistableBundle)` instead for persisted JobWorkItems.

<br />

| Parameters ||
|---|---|
| `intent` | `Intent`: The general Intent describing this work. This value may be `null`. <br /> |
| `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. <br /> |
| `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. <br /> |
| `minimumChunkBytes` | `long`: The smallest piece of data that cannot be easily paused and resumed, in bytes. Value is a non-negative number of bytes. <br /> |

## Public methods

### describeContents

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`,
the return value of this method must include the
`https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### getDeliveryCount

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getDeliveryCount ()
```

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 `https://developer.android.com/reference/android/app/job/JobParameters#completeWork(android.app.job.JobWorkItem)` for it.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### getEstimatedNetworkDownloadBytes

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getEstimatedNetworkDownloadBytes ()
```

Return the estimated size of download traffic that will be performed by
this job, in bytes.


Value is a non-negative number of bytes.

<br />

| Returns ||
|---|---|
| `long` | Estimated size of download traffic, or `https://developer.android.com/reference/android/app/job/JobInfo#NETWORK_BYTES_UNKNOWN` when unknown. Value is a non-negative number of bytes. <br /> |

### getEstimatedNetworkUploadBytes

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getEstimatedNetworkUploadBytes ()
```

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.

<br />

| Returns ||
|---|---|
| `long` | Estimated size of upload traffic, or `https://developer.android.com/reference/android/app/job/JobInfo#NETWORK_BYTES_UNKNOWN` when unknown. Value is a non-negative number of bytes. <br /> |

### getExtras

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PersistableBundle getExtras ()
```

Return the extras associated with this work.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/PersistableBundle` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#setExtras(android.os.PersistableBundle)`

### getIntent

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Intent getIntent ()
```

Return the Intent associated with this work.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/Intent` | <br /> |

### getMinimumNetworkChunkBytes

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getMinimumNetworkChunkBytes ()
```

Return the smallest piece of data that cannot be easily paused and resumed, in bytes.


Value is a non-negative number of bytes.

<br />

| Returns ||
|---|---|
| `long` | Smallest piece of data that cannot be easily paused and resumed, or `https://developer.android.com/reference/android/app/job/JobInfo#NETWORK_BYTES_UNKNOWN` when unknown. Value is a non-negative number of bytes. <br /> |

### toString

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |

### writeToParcel

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void writeToParcel (Parcel out, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `out` | `Parcel`: The Parcel in which the object should be written. This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |