Requirements
@UnstableApi
class Requirements : Parcelable
Defines a set of device state requirements.
Summary
Nested types |
|---|
@DocumentedRequirement flags. |
Constants |
|
|---|---|
const Parcelable.Creator<Requirements!>! |
|
const Int |
DEVICE_CHARGING = 8Requirement that the device is charging. |
const Int |
DEVICE_IDLE = 4Requirement that the device is idle. |
const Int |
Requirement that the device's internal storage is not low. |
const Int |
NETWORK = 1Requirement that the device has network connectivity. |
const Int |
Requirement that the device has a network connection that is unmetered. |
Public constructors |
|---|
Requirements(@Requirements.RequirementFlags requirements: Int) |
Public functions |
|
|---|---|
Boolean |
checkRequirements(context: Context!)Returns whether the requirements are met. |
Int |
|
Boolean |
|
Requirements! |
filterRequirements(requirementsFilter: Int)Filters the requirements, returning the subset that are enabled by the provided filter. |
Int |
Returns requirements that are not met, or 0. |
Int |
hashCode() |
Boolean |
Returns whether the device is required to be charging. |
Boolean |
Returns whether the device is required to be idle. |
Boolean |
Returns whether network connectivity is required. |
Boolean |
Returns whether the device is required to not be low on internal storage. |
Boolean |
Returns whether un-metered network connectivity is required. |
Unit |
writeToParcel(dest: Parcel!, flags: Int) |
Public properties |
|
|---|---|
Int |
Constants
DEVICE_STORAGE_NOT_LOW
const val DEVICE_STORAGE_NOT_LOW = 16: Int
Requirement that the device's internal storage is not low. Note that this requirement is not affected by the status of external storage.
NETWORK_UNMETERED
const val NETWORK_UNMETERED = 2: Int
Requirement that the device has a network connection that is unmetered.
Public constructors
Requirements
Requirements(@Requirements.RequirementFlags requirements: Int)
| Parameters | |
|---|---|
@Requirements.RequirementFlags requirements: Int |
A combination of requirement flags. |
Public functions
checkRequirements
fun checkRequirements(context: Context!): Boolean
Returns whether the requirements are met.
| Parameters | |
|---|---|
context: Context! |
Any context. |
| Returns | |
|---|---|
Boolean |
Whether the requirements are met. |
filterRequirements
fun filterRequirements(requirementsFilter: Int): Requirements!
Filters the requirements, returning the subset that are enabled by the provided filter.
| Parameters | |
|---|---|
requirementsFilter: Int |
The enabled |
| Returns | |
|---|---|
Requirements! |
The filtered requirements. If the filter does not cause a change in the requirements then this instance will be returned. |
getNotMetRequirements
@Requirements.RequirementFlags
fun getNotMetRequirements(context: Context!): Int
Returns requirements that are not met, or 0.
| Parameters | |
|---|---|
context: Context! |
Any context. |
| Returns | |
|---|---|
Int |
The requirements that are not met, or 0. |
isChargingRequired
fun isChargingRequired(): Boolean
Returns whether the device is required to be charging.
isNetworkRequired
fun isNetworkRequired(): Boolean
Returns whether network connectivity is required.
isStorageNotLowRequired
fun isStorageNotLowRequired(): Boolean
Returns whether the device is required to not be low on internal storage.
isUnmeteredNetworkRequired
fun isUnmeteredNetworkRequired(): Boolean
Returns whether un-metered network connectivity is required.