DiscoverySession.CreateNetworkSpecifierPassphrase(PeerHandle, String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Create a android.net.NetworkRequest.Builder#setNetworkSpecifier(NetworkSpecifier)
for
an encrypted WiFi Aware connection (link) to the specified peer.
[Android.Runtime.Register("createNetworkSpecifierPassphrase", "(Landroid/net/wifi/aware/PeerHandle;Ljava/lang/String;)Landroid/net/NetworkSpecifier;", "GetCreateNetworkSpecifierPassphrase_Landroid_net_wifi_aware_PeerHandle_Ljava_lang_String_Handler", ApiSince=26)]
public virtual Android.Net.NetworkSpecifier? CreateNetworkSpecifierPassphrase (Android.Net.Wifi.Aware.PeerHandle peerHandle, string passphrase);
[<Android.Runtime.Register("createNetworkSpecifierPassphrase", "(Landroid/net/wifi/aware/PeerHandle;Ljava/lang/String;)Landroid/net/NetworkSpecifier;", "GetCreateNetworkSpecifierPassphrase_Landroid_net_wifi_aware_PeerHandle_Ljava_lang_String_Handler", ApiSince=26)>]
abstract member CreateNetworkSpecifierPassphrase : Android.Net.Wifi.Aware.PeerHandle * string -> Android.Net.NetworkSpecifier
override this.CreateNetworkSpecifierPassphrase : Android.Net.Wifi.Aware.PeerHandle * string -> Android.Net.NetworkSpecifier
Parameters
- peerHandle
- PeerHandle
The peer's handle obtained through
DiscoverySessionCallback#onServiceDiscovered(PeerHandle,
byte[], java.util.List)
or
DiscoverySessionCallback#onMessageReceived(PeerHandle,
byte[])
. On a RESPONDER this value is used to gate the acceptance of a connection request
from only that peer.
- passphrase
- String
The passphrase to be used to encrypt the link. The PMK is generated from
the passphrase. Use the
#createNetworkSpecifierOpen(PeerHandle)
API to
specify an open (unencrypted) link.
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 encrypted 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 method should be used when setting up a connection with a peer discovered through Aware discovery or communication (in such scenarios the MAC address of the peer is shielded by an opaque peer ID handle). If an Aware connection is needed to a peer discovered using other OOB (out-of-band) mechanism then use the alternative WifiAwareSession#createNetworkSpecifierPassphrase(int, byte[], String)
method - which uses the peer's MAC address.
Note: per the Wi-Fi Aware specification the roles are fixed - a Subscriber is an INITIATOR and a Publisher is a RESPONDER.
This member is deprecated. Use the replacement WifiAwareNetworkSpecifier.Builder
.
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.