Language

WifiP2pManager.StartPeerDiscovery Method

Definition

Initiate peer discovery.

[Android.Runtime.Register("startPeerDiscovery", "(Landroid/net/wifi/p2p/WifiP2pManager$Channel;Landroid/net/wifi/p2p/WifiP2pDiscoveryConfig;Landroid/net/wifi/p2p/WifiP2pManager$ActionListener;)V", "GetStartPeerDiscovery_Landroid_net_wifi_p2p_WifiP2pManager_Channel_Landroid_net_wifi_p2p_WifiP2pDiscoveryConfig_Landroid_net_wifi_p2p_WifiP2pManager_ActionListener_Handler", ApiSince=35)]
public virtual void StartPeerDiscovery(Android.Net.Wifi.P2p.WifiP2pManager.Channel channel, Android.Net.Wifi.P2p.WifiP2pDiscoveryConfig config, Android.Net.Wifi.P2p.WifiP2pManager.IActionListener? listener);
[<Android.Runtime.Register("startPeerDiscovery", "(Landroid/net/wifi/p2p/WifiP2pManager$Channel;Landroid/net/wifi/p2p/WifiP2pDiscoveryConfig;Landroid/net/wifi/p2p/WifiP2pManager$ActionListener;)V", "GetStartPeerDiscovery_Landroid_net_wifi_p2p_WifiP2pManager_Channel_Landroid_net_wifi_p2p_WifiP2pDiscoveryConfig_Landroid_net_wifi_p2p_WifiP2pManager_ActionListener_Handler", ApiSince=35)>]
abstract member StartPeerDiscovery : Android.Net.Wifi.P2p.WifiP2pManager.Channel * Android.Net.Wifi.P2p.WifiP2pDiscoveryConfig * Android.Net.Wifi.P2p.WifiP2pManager.IActionListener -> unit
override this.StartPeerDiscovery : Android.Net.Wifi.P2p.WifiP2pManager.Channel * Android.Net.Wifi.P2p.WifiP2pDiscoveryConfig * Android.Net.Wifi.P2p.WifiP2pManager.IActionListener -> unit

Parameters

channel
WifiP2pManager.Channel

The channel created by Initialize(Context, Looper, WifiP2pManager+IChannelListener). This value cannot be null.

config
WifiP2pDiscoveryConfig

is the configuration for this peer discovery. This value cannot be null.

listener
WifiP2pManager.IActionListener

for callbacks on success or failure. This value may be null.

Attributes

Remarks

Initiate peer discovery. A discovery process involves scanning for available Wi-Fi peers for the purpose of establishing a connection. See DiscoverPeers(WifiP2pManager+Channel, WifiP2pManager+IActionListener) for more details. This method accepts a WifiP2pDiscoveryConfig object specifying the desired parameters for the peer discovery. The configuration object allows the specification of the scan type (ex. FULL, SOCIAL) and, for a single-frequency scan, the frequency. On Android 13 (API level 33) or later, if the app targets API level 33 or later, it needs android.permission.NEARBY_WIFI_DEVICES. If the app does not declare android:usesPermissionFlags="neverForLocation" for that permission, it also needs android.permission.ACCESS_FINE_LOCATION. On earlier Android versions, or if the app targets an earlier API level, it needs android.permission.ACCESS_FINE_LOCATION.

Android reference for android.net.wifi.p2p.WifiP2pManager.startPeerDiscovery.

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