Partager via


WifiAwareSession.CreateNetworkSpecifierOpen Method

Definition

Create a android.net.NetworkRequest.Builder#setNetworkSpecifier(NetworkSpecifier) for an unencrypted WiFi Aware connection (link) to the specified peer.

[Android.Runtime.Register("createNetworkSpecifierOpen", "(I[B)Landroid/net/NetworkSpecifier;", "GetCreateNetworkSpecifierOpen_IarrayBHandler", ApiSince=26)]
public virtual Android.Net.NetworkSpecifier? CreateNetworkSpecifierOpen (Android.Net.Wifi.Aware.WifiAwareDataPathRole role, byte[] peer);
[<Android.Runtime.Register("createNetworkSpecifierOpen", "(I[B)Landroid/net/NetworkSpecifier;", "GetCreateNetworkSpecifierOpen_IarrayBHandler", ApiSince=26)>]
abstract member CreateNetworkSpecifierOpen : Android.Net.Wifi.Aware.WifiAwareDataPathRole * byte[] -> Android.Net.NetworkSpecifier
override this.CreateNetworkSpecifierOpen : Android.Net.Wifi.Aware.WifiAwareDataPathRole * byte[] -> Android.Net.NetworkSpecifier

Parameters

role
WifiAwareDataPathRole

The role of this device: WifiAwareManager#WIFI_AWARE_DATA_PATH_ROLE_INITIATOR or WifiAwareManager#WIFI_AWARE_DATA_PATH_ROLE_RESPONDER

peer
Byte[]

The MAC address of the peer's Aware discovery interface. On a RESPONDER this value is used to gate the acceptance of a connection request from only that peer.

Returns

A NetworkSpecifier to be used to construct android.net.NetworkRequest.Builder#setNetworkSpecifier(NetworkSpecifier) to pass to android.net.ConnectivityManager#requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback) [or other varieties of that API].

Attributes

Remarks

Create a android.net.NetworkRequest.Builder#setNetworkSpecifier(NetworkSpecifier) for an unencrypted WiFi Aware connection (link) to the specified peer. The android.net.NetworkRequest.Builder#addTransportType(int) should be set to android.net.NetworkCapabilities#TRANSPORT_WIFI_AWARE.

This API is targeted for applications which can obtain the peer MAC address using OOB (out-of-band) discovery. Aware discovery does not provide the MAC address of the peer - when using Aware discovery use the alternative network specifier method - android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder.

To set up an encrypted link use the #createNetworkSpecifierPassphrase(int, byte[], String) API.

This member is deprecated. Please use in-band data-path setup, refer to WifiAwareNetworkSpecifier.Builder, #publish(PublishConfig, DiscoverySessionCallback, Handler) and #subscribe(SubscribeConfig, DiscoverySessionCallback, Handler)

Java documentation for android.net.wifi.aware.WifiAwareSession.createNetworkSpecifierOpen(int, byte[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to