Added in API level 29

WifiAwareNetworkInfo


class WifiAwareNetworkInfo : Parcelable, TransportInfo
kotlin.Any
   ↳ android.net.wifi.aware.WifiAwareNetworkInfo

Wi-Fi Aware-specific network information. The information can be extracted from the android.net.NetworkCapabilities of the network using NetworkCapabilities.getTransportInfo(). The NetworkCapabilities is provided by the connectivity service to apps, e.g. received through the android.net.ConnectivityManager.NetworkCallback#onCapabilitiesChanged(android.net.Network, android.net.NetworkCapabilities) callback.

The Wi-Fi Aware-specific network information include the peer's scoped link-local IPv6 address for the Wi-Fi Aware link, as well as (optionally) the port and transport protocol specified by the peer. The scoped link-local IPv6, port, and transport protocol can then be used to create a java.net.Socket connection to the peer.

Note: these are the peer's IPv6 and port information - not the local device's!

Summary

Inherited constants
Public methods
Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

Boolean
equals(other: Any?)

MutableList<WifiAwareChannelInfo!>

Get a list WifiAwareChannelInfo which is used by this Aware data-path

Inet6Address?

Get the scoped link-local IPv6 address of the Wi-Fi Aware peer (not of the local device!).

Int

Get the port number to be used to create a network connection to the Wi-Fi Aware peer.

Int

Get the transport protocol to be used to communicate over a network connection to the Wi-Fi Aware peer.

Int

String

Returns a string representation of the object.

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<WifiAwareNetworkInfo!>

Public methods

describeContents

Added in API level 29
fun describeContents(): Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

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.

getChannelInfoList

Added in API level 33
fun getChannelInfoList(): MutableList<WifiAwareChannelInfo!>

Get a list WifiAwareChannelInfo which is used by this Aware data-path

Return
MutableList<WifiAwareChannelInfo!> A list of WifiAwareChannelInfo
This value cannot be null.

getPeerIpv6Addr

Added in API level 29
fun getPeerIpv6Addr(): Inet6Address?

Get the scoped link-local IPv6 address of the Wi-Fi Aware peer (not of the local device!).

Return
Inet6Address? An IPv6 address.
This value may be null.

getPort

Added in API level 29
fun getPort(): Int

Get the port number to be used to create a network connection to the Wi-Fi Aware peer. The port information is provided by the app running on the peer which requested the connection, using the WifiAwareNetworkSpecifier.Builder.setPort(int).

Return
Int A port number on the peer. A value of 0 indicates that no port was specified by the peer.

getTransportProtocol

Added in API level 29
fun getTransportProtocol(): Int

Get the transport protocol to be used to communicate over a network connection to the Wi-Fi Aware peer. The transport protocol is provided by the app running on the peer which requested the connection, using the WifiAwareNetworkSpecifier.Builder.setTransportProtocol(int).

The transport protocol number is assigned by the Internet Assigned Numbers Authority (IANA) https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml.

Return
Int A transport protocol id. A value of -1 indicates that no transport protocol was specified by the peer.

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

Returns a string representation of the object.

Return
String a string representation of the object.

writeToParcel

Added in API level 29
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

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 the following:

Properties

CREATOR

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