Constraints

data class Constraints(val requiredNetworkType: NetworkType = NetworkType.NOT_REQUIRED, val requiresCharging: Boolean = false, val requiresBatteryNotLow: Boolean = false, val requiresStorageNotLow: Boolean = false, val requiresDeviceIdle: Boolean = false)(source)

Device conditions that must hold before a job is allowed to run.

Constraints are re-evaluated by the scheduler, so a job whose constraints stop being satisfied while it is running is stopped and retried later.

val constraints = constraints {
requiredNetworkType = NetworkType.UNMETERED
requiresCharging = true
}

Constructors

Link copied to clipboard
constructor(requiredNetworkType: NetworkType = NetworkType.NOT_REQUIRED, requiresCharging: Boolean = false, requiresBatteryNotLow: Boolean = false, requiresStorageNotLow: Boolean = false, requiresDeviceIdle: Boolean = false)

Types

Link copied to clipboard
class Builder

Builder form of Constraints, convenient from Swift and Java.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Connectivity the job requires.

Link copied to clipboard

Requires the battery to be above the system's low-battery threshold.

Link copied to clipboard

Requires the device to be plugged into power.

Link copied to clipboard

Requires the device to be idle.

Link copied to clipboard

Requires free storage above the system's low-storage threshold.