다음을 통해 공유


DiscoverySession.InitiatePairingRequest Method

Definition

Initiate a Wi-Fi Aware Pairing setup request to create a pairing with the target peer.

[Android.Runtime.Register("initiatePairingRequest", "(Landroid/net/wifi/aware/PeerHandle;Ljava/lang/String;ILjava/lang/String;)V", "GetInitiatePairingRequest_Landroid_net_wifi_aware_PeerHandle_Ljava_lang_String_ILjava_lang_String_Handler", ApiSince=34)]
public virtual void InitiatePairingRequest (Android.Net.Wifi.Aware.PeerHandle peerHandle, string peerDeviceAlias, Android.Net.Wifi.Aware.WifiAwareCipherSuite cipherSuite, string? password);
[<Android.Runtime.Register("initiatePairingRequest", "(Landroid/net/wifi/aware/PeerHandle;Ljava/lang/String;ILjava/lang/String;)V", "GetInitiatePairingRequest_Landroid_net_wifi_aware_PeerHandle_Ljava_lang_String_ILjava_lang_String_Handler", ApiSince=34)>]
abstract member InitiatePairingRequest : Android.Net.Wifi.Aware.PeerHandle * string * Android.Net.Wifi.Aware.WifiAwareCipherSuite * string -> unit
override this.InitiatePairingRequest : Android.Net.Wifi.Aware.PeerHandle * string * Android.Net.Wifi.Aware.WifiAwareCipherSuite * string -> unit

Parameters

peerHandle
PeerHandle

The peer's handle for the pairing request. Must be a result of a DiscoverySessionCallback#onServiceDiscovered(ServiceDiscoveryInfo) or DiscoverySessionCallback#onMessageReceived(PeerHandle, byte[]) events.

peerDeviceAlias
String

The alias of paired device set by caller, will help caller to identify the paired device.

cipherSuite
WifiAwareCipherSuite

The cipher suite to be used to encrypt the link.

password
String

The password used for the pairing setup. If set to empty or null, opportunistic pairing will be used.

Attributes

Remarks

Initiate a Wi-Fi Aware Pairing setup request to create a pairing with the target peer. The Aware pairing request should be done in the context of a discovery session - after a publish/subscribe DiscoverySessionCallback#onServiceDiscovered(ServiceDiscoveryInfo) event is received. The peer will get a callback indicating a message was received using DiscoverySessionCallback#onPairingSetupRequestReceived(PeerHandle, int). When the Aware Pairing setup is finished, both sides will receive DiscoverySessionCallback#onPairingSetupSucceeded(PeerHandle, String)

Java documentation for android.net.wifi.aware.DiscoverySession.initiatePairingRequest(android.net.wifi.aware.PeerHandle, java.lang.String, int, java.lang.String).

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