Google berkomitmen untuk mendorong terwujudnya keadilan ras bagi komunitas Kulit Hitam. Lihat caranya.

Builder

class Builder
kotlin.Any
   ↳ androidx.work.Constraints.Builder

A Builder for a Constraints object.

Summary

Public constructors

Public methods
Constraints.Builder
addContentUriTrigger(@NonNull uri: Uri, triggerForDescendants: Boolean)

Sets whether the WorkRequest should run when a local content: Uri is updated.

Constraints

Generates the Constraints from this Builder.

Constraints.Builder
setRequiredNetworkType(@NonNull networkType: NetworkType)

Sets whether device should have a particular NetworkType for the WorkRequest to run.

Constraints.Builder
setRequiresBatteryNotLow(requiresBatteryNotLow: Boolean)

Sets whether device battery should be at an acceptable level for the WorkRequest to run.

Constraints.Builder
setRequiresCharging(requiresCharging: Boolean)

Sets whether device should be charging for the WorkRequest to run.

Constraints.Builder
setRequiresDeviceIdle(requiresDeviceIdle: Boolean)

Sets whether device should be idle for the WorkRequest to run.

Constraints.Builder
setRequiresStorageNotLow(requiresStorageNotLow: Boolean)

Sets whether the device's available storage should be at an acceptable level for the WorkRequest to run.

Constraints.Builder
setTriggerContentMaxDelay(duration: Long, @NonNull timeUnit: TimeUnit)

Sets the maximum delay that is allowed from the first time a content: Uri change is detected to the time when the WorkRequest is scheduled.

Constraints.Builder

Sets the maximum delay that is allowed from the first time a content: Uri change is detected to the time when the WorkRequest is scheduled.

Constraints.Builder
setTriggerContentUpdateDelay(duration: Long, @NonNull timeUnit: TimeUnit)

Sets the delay that is allowed from the time a content: Uri change is detected to the time when the WorkRequest is scheduled.

Constraints.Builder

Sets the delay that is allowed from the time a content: Uri change is detected to the time when the WorkRequest is scheduled.

Public constructors

<init>

Builder()

Public methods

addContentUriTrigger

@RequiresApi(24) @NonNull fun addContentUriTrigger(
    @NonNull uri: Uri,
    triggerForDescendants: Boolean
): Constraints.Builder

Sets whether the WorkRequest should run when a local content: Uri is updated. This functionality is identical to the one found in JobScheduler and is described in JobInfo.Builder#addTriggerContentUri(android.app.job.JobInfo.TriggerContentUri).

Parameters
uri Uri: The local content: Uri to observe
triggerForDescendants Boolean: true if any changes in descendants cause this WorkRequest to run
Return
Constraints.Builder The current Builder

build

@NonNull fun build(): Constraints

Generates the Constraints from this Builder.

Return
Constraints The Constraints specified by this Builder

setRequiredNetworkType

@NonNull fun setRequiredNetworkType(@NonNull networkType: NetworkType): Constraints.Builder

Sets whether device should have a particular NetworkType for the WorkRequest to run. The default value is NetworkType#NOT_REQUIRED.

Parameters
networkType NetworkType: The type of network required for the work to run
Return
Constraints.Builder The current Builder

setRequiresBatteryNotLow

@NonNull fun setRequiresBatteryNotLow(requiresBatteryNotLow: Boolean): Constraints.Builder

Sets whether device battery should be at an acceptable level for the WorkRequest to run. The default value is false.

Parameters
requiresBatteryNotLow Boolean: true if the battery should be at an acceptable level for the work to run
Return
Constraints.Builder The current Builder

setRequiresCharging

@NonNull fun setRequiresCharging(requiresCharging: