Builder
class Builder
Builder class for constructing JobWorkItem
objects.
Summary
Public constructors |
Initialize a new Builder to construct a JobWorkItem object.
|
Public constructors
Builder
Builder()
Initialize a new Builder to construct a JobWorkItem
object.
Public methods
build
fun build(): JobWorkItem
Return |
JobWorkItem |
The JobWorkItem object to hand to the JobScheduler. This object is immutable. This value cannot be null . |
setEstimatedNetworkBytes
fun setEstimatedNetworkBytes(
downloadBytes: Long,
uploadBytes: Long
): JobWorkItem.Builder
Set the estimated size of network traffic that will be performed for this work item, in bytes. See JobInfo.Builder.setEstimatedNetworkBytes(long, long)
for details about how to estimate network traffic.
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. |
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. |
fun setExtras(extras: PersistableBundle): JobWorkItem.Builder
Set optional extras. This can be persisted, so we only allow primitive types.
Parameters |
extras |
PersistableBundle: Bundle containing extras you want the scheduler to hold on to for you. This value cannot be null . |
setMinimumNetworkChunkBytes
fun setMinimumNetworkChunkBytes(chunkSizeBytes: Long): JobWorkItem.Builder
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 setEstimatedNetworkBytes(long,long)
. See JobInfo.Builder.setMinimumNetworkChunkBytes(long)
for details about how to set the minimum chunk.
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. |