@UnstableApi
class Requirements : Parcelable


Defines a set of device state requirements.

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = )
@IntDef(flag = true, value = )
annotation Requirements.RequirementFlags

Requirement flags.

Constants

const Parcelable.Creator<Requirements!>!
const Int

Requirement that the device is charging.

const Int

Requirement that the device is idle.

const Int

Requirement that the device's internal storage is not low.

const Int

Requirement that the device has network connectivity.

const Int

Requirement that the device has a network connection that is unmetered.

Public constructors

Public functions

Boolean

Returns whether the requirements are met.

Int
Boolean
equals(o: Any?)
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
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)

Constants

CREATOR

const val CREATORParcelable.Creator<Requirements!>!

DEVICE_CHARGING

const val DEVICE_CHARGING = 8: Int

Requirement that the device is charging.

DEVICE_IDLE

const val DEVICE_IDLE = 4: Int

Requirement that the device is idle.

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

const val NETWORK = 1: Int

Requirement that the device has network connectivity.

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.

describeContents

fun describeContents(): Int

equals

fun equals(o: Any?): Boolean

filterRequirements

fun filterRequirements(requirementsFilter: Int): Requirements!

Filters the requirements, returning the subset that are enabled by the provided filter.

Parameters
requirementsFilter: Int

The enabled RequirementFlags.

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.

hashCode

fun hashCode(): Int

isChargingRequired

fun isChargingRequired(): Boolean

Returns whether the device is required to be charging.

isIdleRequired

fun isIdleRequired(): Boolean

Returns whether the device is required to be idle.

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.

writeToParcel

fun writeToParcel(dest: Parcel!, flags: Int): Unit

Public properties