Constraints
class Constraints
A specification of the requirements that need to be met before a WorkRequest
can run. By default, WorkRequests do not have any requirements and can run immediately. By adding requirements, you can make sure that work only runs in certain situations - for example, when you have an unmetered network and are charging.
Summary
Properties
|
static Constraints! |
Represents a Constraints object with no requirements.
|
Public constructors
Public methods
getRequiredNetworkType
@NonNull fun getRequiredNetworkType(): NetworkType
hashCode
fun hashCode(): Int
requiresBatteryNotLow
fun requiresBatteryNotLow(): Boolean
Return |
Boolean: true if the work should only execute when the battery isn't low |
requiresCharging
fun requiresCharging(): Boolean
Return |
Boolean: true if the work should only execute while the device is charging |
requiresDeviceIdle
fun requiresDeviceIdle(): Boolean
Return |
Boolean: true if the work should only execute while the device is idle |
requiresStorageNotLow
fun requiresStorageNotLow(): Boolean
Return |
Boolean: true if the work should only execute when the storage isn't low |
Properties
NONE
static val NONE: Constraints!
Represents a Constraints object with no requirements.