Language

WifiP2pManager.DiscoverUsdBasedServices Method

Definition

Initiate Un-synchronized service discovery (USD) based service discovery.

[Android.Runtime.Register("discoverUsdBasedServices", "(Landroid/net/wifi/p2p/WifiP2pManager$Channel;Landroid/net/wifi/p2p/WifiP2pUsdBasedServiceDiscoveryConfig;Landroid/net/wifi/p2p/WifiP2pManager$ActionListener;)V", "GetDiscoverUsdBasedServices_Landroid_net_wifi_p2p_WifiP2pManager_Channel_Landroid_net_wifi_p2p_WifiP2pUsdBasedServiceDiscoveryConfig_Landroid_net_wifi_p2p_WifiP2pManager_ActionListener_Handler", ApiSince=36)]
public virtual void DiscoverUsdBasedServices(Android.Net.Wifi.P2p.WifiP2pManager.Channel channel, Android.Net.Wifi.P2p.WifiP2pUsdBasedServiceDiscoveryConfig config, Android.Net.Wifi.P2p.WifiP2pManager.IActionListener? listener);
[<Android.Runtime.Register("discoverUsdBasedServices", "(Landroid/net/wifi/p2p/WifiP2pManager$Channel;Landroid/net/wifi/p2p/WifiP2pUsdBasedServiceDiscoveryConfig;Landroid/net/wifi/p2p/WifiP2pManager$ActionListener;)V", "GetDiscoverUsdBasedServices_Landroid_net_wifi_p2p_WifiP2pManager_Channel_Landroid_net_wifi_p2p_WifiP2pUsdBasedServiceDiscoveryConfig_Landroid_net_wifi_p2p_WifiP2pManager_ActionListener_Handler", ApiSince=36)>]
abstract member DiscoverUsdBasedServices : Android.Net.Wifi.P2p.WifiP2pManager.Channel * Android.Net.Wifi.P2p.WifiP2pUsdBasedServiceDiscoveryConfig * Android.Net.Wifi.P2p.WifiP2pManager.IActionListener -> unit
override this.DiscoverUsdBasedServices : Android.Net.Wifi.P2p.WifiP2pManager.Channel * Android.Net.Wifi.P2p.WifiP2pUsdBasedServiceDiscoveryConfig * 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
WifiP2pUsdBasedServiceDiscoveryConfig

is the configuration for this USD based service discovery. This value cannot be null.

listener
WifiP2pManager.IActionListener

for callbacks on success or failure. Can be null.

Attributes

Remarks

Initiate Un-synchronized service discovery (USD) based service discovery. A discovery process involves scanning for requested services for the purpose of establishing a connection to a peer that supports an available service using USD protocol. This method accepts a WifiP2pUsdBasedServiceDiscoveryConfig object specifying the desired parameters for the service discovery. The configuration object allows to specify either a band or frequency list to scan for service.

The function call immediately returns after sending a request to start service discovery to the framework. The application is notified of a success or failure to initiate discovery through listener callbacks OnSuccess() or OnFailure(WifiP2pFailureReason).

The USD based services to be discovered are specified with calls to AddServiceRequest(WifiP2pManager+Channel, WifiP2pServiceRequest, WifiP2pManager+IActionListener) with the service request information set through WifiP2pServiceRequest(WifiP2pUsdBasedServiceConfig)

The application is notified of the response against the service discovery request via OnUsdBasedServiceAvailable(WifiP2pDevice, WifiP2pUsdBasedServiceResponse) listener callback registered by SetServiceResponseListener(WifiP2pManager+Channel, WifiP2pManager+IServiceResponseListener).

Check IsWiFiDirectR2Supported to determine whether the device supports this feature. This method throws UnsupportedOperationException if the property is false.

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.discoverUsdBasedServices.

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