WorkConstraints

@Serializable
data class WorkConstraints(val networkRequired: NetworkRequirement = NetworkRequirement.None, val requiresCharging: Boolean = false, val requiresDeviceIdle: Boolean = false)

Conditions a WorkRequest needs satisfied before the platform scheduler will dispatch it.

v1 exposes the lowest-common-denominator across Android and iOS. Android-only constraints (storage-not-low, battery-not-low, content URI triggers) land in v2 via a WorkConstraints.Android extension.

Constructors

Link copied to clipboard
constructor(networkRequired: NetworkRequirement = NetworkRequirement.None, requiresCharging: Boolean = false, requiresDeviceIdle: Boolean = false)

Properties

Link copied to clipboard

Network connectivity level required before the scheduler dispatches this request.

Link copied to clipboard

If true, the device must be connected to external power before dispatching.

Link copied to clipboard

If true, the device must be idle (in Doze mode or a maintenance window on Android) before dispatching.