Constraints
public
final
class
Constraints
extends Object
java.lang.Object
|
↳ |
androidx.work.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
Nested classes |
class |
Constraints.Builder
A Builder for a Constraints object.
|
Fields |
public
static
final
Constraints |
NONE
Represents a Constraints object with no requirements.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Fields
NONE
public static final Constraints NONE
Represents a Constraints object with no requirements.
Public constructors
Constraints
public Constraints (Constraints other)
Parameters |
other |
Constraints |
Public methods
equals
public boolean equals (Object o)
getRequiredNetworkType
public NetworkType getRequiredNetworkType ()
hashCode
public int hashCode ()
requiresBatteryNotLow
public boolean requiresBatteryNotLow ()
Returns |
boolean |
true if the work should only execute when the battery isn't low
|
requiresCharging
public boolean requiresCharging ()
Returns |
boolean |
true if the work should only execute while the device is charging
|
requiresDeviceIdle
public boolean requiresDeviceIdle ()
Returns |
boolean |
true if the work should only execute while the device is idle
|
requiresStorageNotLow
public boolean requiresStorageNotLow ()
Returns |
boolean |
true if the work should only execute when the storage isn't low
|
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples/Code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-09-30 UTC.