Android.Net.Nsd.NsdManager.DiscoverServices Method
Initiate service discovery to browse for instances of a service type.

Syntax

[Android.Runtime.Register("discoverServices", "(Ljava/lang/String;ILandroid/net/nsd/NsdManager$DiscoveryListener;)V", "")]
public void DiscoverServices (string serviceType, [Android.Runtime.GeneratedEnum] NsdProtocol protocolType, NsdManager.IDiscoveryListener listener)

Parameters

serviceType
The service type being discovered. Examples include "_http._tcp" for http services or "_ipp._tcp" for printers
protocolType
The service discovery protocol
listener
The listener notifies of a successful discovery and is used to stop discovery on this serviceType through a call on NsdManager.StopServiceDiscovery(.IDiscoveryListener). Cannot be null. Cannot be in use for an active service discovery.

Remarks

Initiate service discovery to browse for instances of a service type. Service discovery consumes network bandwidth and will continue until the application calls NsdManager.StopServiceDiscovery(.IDiscoveryListener).

The function call immediately returns after sending a request to start service discovery to the framework. The application is notified of a success to initiate discovery through the callback NoType:android/net/nsd/NsdManager$DiscoveryListener;Href=../../../../reference/android/net/nsd/NsdManager.DiscoveryListener.html#onDiscoveryStarted(java.lang.String) or a failure through NoType:android/net/nsd/NsdManager$DiscoveryListener;Href=../../../../reference/android/net/nsd/NsdManager.DiscoveryListener.html#onStartDiscoveryFailed(java.lang.String, int).

Upon successful start, application is notified when a service is found with NoType:android/net/nsd/NsdManager$DiscoveryListener;Href=../../../../reference/android/net/nsd/NsdManager.DiscoveryListener.html#onServiceFound(android.net.nsd.NsdServiceInfo) or when a service is lost with NoType:android/net/nsd/NsdManager$DiscoveryListener;Href=../../../../reference/android/net/nsd/NsdManager.DiscoveryListener.html#onServiceLost(android.net.nsd.NsdServiceInfo).

Upon failure to start, service discovery is not active and application does not need to invoke NsdManager.StopServiceDiscovery(.IDiscoveryListener)

The application should call NsdManager.StopServiceDiscovery(.IDiscoveryListener) when discovery of this service type is no longer required, and/or whenever the application is paused or stopped.

[Android Documentation]

Requirements

Namespace: Android.Net.Nsd
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 16