Added in API level 29

WifiNetworkSpecifier


class WifiNetworkSpecifier : NetworkSpecifier, Parcelable
kotlin.Any
   ↳ android.net.NetworkSpecifier
   ↳ android.net.wifi.WifiNetworkSpecifier

Network specifier object used to request a Wi-Fi network. Apps should use the WifiNetworkSpecifier.Builder class to create an instance.

This specifier can be used to request a local-only connection on devices that support concurrent connections (indicated via WifiManager#isStaConcurrencyForLocalOnlyConnectionsSupported() and if the initiating app targets SDK ≥ android.os.Build.VERSION_CODES#S or is a system app. These local-only connections may be brought up as a secondary concurrent connection (primary connection will be used for networks with internet connectivity available to the user and all apps).

This specifier can also be used to listen for connected Wi-Fi networks on a particular band. Additionally, some devices may support requesting a connection to a particular band. If the device does not support such a request, it will send NetworkCallback#onUnavailable() upon request to the callback passed to ConnectivityManager#requestNetwork(NetworkRequest, NetworkCallback) or equivalent. See Builder#build() for details.

Summary

Nested classes

Builder used to create WifiNetworkSpecifier objects.

Inherited constants
Public methods
Int

Boolean
equals(other: Any?)

Int

The band for this Wi-Fi network specifier.

IntArray

The preferred channels fot this network specifier.

Int

String

Unit
writeToParcel(dest: Parcel, flags: Int)

Properties
static Parcelable.Creator<WifiNetworkSpecifier!>

Public methods

describeContents

Added in API level 29
fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

equals

Added in API level 29
fun equals(other: Any?): Boolean
Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getPreferredChannelFrequenciesMhz

Added in API level 34
fun getPreferredChannelFrequenciesMhz(): IntArray

The preferred channels fot this network specifier.

Return
IntArray This value cannot be null.

hashCode

Added in API level 29
fun hashCode(): Int
Return
Int a hash code value for this object.

toString

Added in API level 29
fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 29
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit
Parameters
dest Parcel: The Parcel in which the object should be written. This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 29
static val CREATOR: Parcelable.Creator<WifiNetworkSpecifier!>