Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#inhmethods)

# JobWorkItem.Builder

*** ** * ** ***

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


`
public
static
final

class
JobWorkItem.Builder
`


`

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


`

`


`

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

<br />

*** ** * ** ***

Builder class for constructing `https://developer.android.com/reference/android/app/job/JobWorkItem` objects.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#Builder()() ` Initialize a new Builder to construct a `https://developer.android.com/reference/android/app/job/JobWorkItem` object. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/app/job/JobWorkItem` | ` https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#build()() ` |
| ` https://developer.android.com/reference/android/app/job/JobWorkItem.Builder` | ` https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#setEstimatedNetworkBytes(long,%20long)(long downloadBytes, long uploadBytes) ` Set the estimated size of network traffic that will be performed for this work item, in bytes. |
| ` https://developer.android.com/reference/android/app/job/JobWorkItem.Builder` | ` https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#setExtras(android.os.PersistableBundle)(https://developer.android.com/reference/android/os/PersistableBundle extras) ` Set optional extras. |
| ` https://developer.android.com/reference/android/app/job/JobWorkItem.Builder` | ` https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#setIntent(android.content.Intent)(https://developer.android.com/reference/android/content/Intent intent) ` Set an intent with information relevant to this work item. |
| ` https://developer.android.com/reference/android/app/job/JobWorkItem.Builder` | ` https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#setMinimumNetworkChunkBytes(long)(long chunkSizeBytes) ` Set the minimum size of non-resumable network traffic this work item requires, in bytes. |

| ### 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*. | ||

## Public constructors

### Builder

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

```
public Builder ()
```

Initialize a new Builder to construct a `https://developer.android.com/reference/android/app/job/JobWorkItem` object.

<br />

## Public methods

### build

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

```
public JobWorkItem build ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/job/JobWorkItem` | The JobWorkItem object to hand to the JobScheduler. This object is immutable. This value cannot be `null`. <br /> |

### setEstimatedNetworkBytes

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

```
public JobWorkItem.Builder setEstimatedNetworkBytes (long downloadBytes, 
                long uploadBytes)
```

Set the estimated size of network traffic that will be performed for this work item,
in bytes.

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

<br />

| Parameters ||
|---|---|
| `downloadBytes` | `long`: The estimated size of network traffic that will be downloaded for this 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 for this work item, in bytes. Value is a non-negative number of bytes. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/job/JobWorkItem.Builder` | This object for method chaining. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/job/JobInfo.Builder#setEstimatedNetworkBytes(long,%20long)`
- `https://developer.android.com/reference/android/app/job/JobWorkItem#getEstimatedNetworkDownloadBytes()`
- `https://developer.android.com/reference/android/app/job/JobWorkItem#getEstimatedNetworkUploadBytes()`

### setExtras

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

```
public JobWorkItem.Builder setExtras (PersistableBundle extras)
```

Set optional extras. This can be persisted, so we only allow primitive types.

<br />

| Parameters ||
|---|---|
| `extras` | `PersistableBundle`: Bundle containing extras you want the scheduler to hold on to for you. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/job/JobWorkItem.Builder` | This object for method chaining. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/job/JobWorkItem#getExtras()`

### setIntent

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

```
public JobWorkItem.Builder setIntent (Intent intent)
```

Set an intent with information relevant to this work item.


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`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/job/JobWorkItem.Builder` | This object for method chaining. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/job/JobWorkItem#getIntent()`

### setMinimumNetworkChunkBytes

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

```
public JobWorkItem.Builder setMinimumNetworkChunkBytes (long chunkSizeBytes)
```

Set the minimum size of non-resumable network traffic this work item requires, in bytes.
When the upload or download can be easily paused and resumed, use this to set the
smallest size that must be transmitted between start and stop events to be considered
successful. If the transfer cannot be paused and resumed, then this should be the sum
of the values provided to `https://developer.android.com/reference/android/app/job/JobWorkItem.Builder#setEstimatedNetworkBytes(long,%20long)`.

See `https://developer.android.com/reference/android/app/job/JobInfo.Builder#setMinimumNetworkChunkBytes(long)` for
details about how to set the minimum chunk.

<br />

| Parameters ||
|---|---|
| `chunkSizeBytes` | `long`: The smallest piece of data that cannot be easily paused and resumed, in bytes. Value is a non-negative number of bytes. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/job/JobWorkItem.Builder` | This object for method chaining. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/job/JobInfo.Builder#setMinimumNetworkChunkBytes(long)`
- `https://developer.android.com/reference/android/app/job/JobWorkItem#getMinimumNetworkChunkBytes()`
- `https://developer.android.com/reference/android/app/job/JobWorkItem#JobWorkItem(android.content.Intent,%20long,%20long,%20long)`