Language

NsdManager.RegisterServiceInfoCallback Method

Definition

Overloads

Name Description
RegisterServiceInfoCallback(DiscoveryRequest, IExecutor, NsdManager+IServiceInfoCallback)

Register a callback to discover and track updates of services.

RegisterServiceInfoCallback(NsdServiceInfo, IExecutor, NsdManager+IServiceInfoCallback)

Register a callback to listen for updates to a service.

RegisterServiceInfoCallback(DiscoveryRequest, IExecutor, NsdManager+IServiceInfoCallback)

Register a callback to discover and track updates of services.

[Android.Runtime.Register("registerServiceInfoCallback", "(Landroid/net/nsd/DiscoveryRequest;Ljava/util/concurrent/Executor;Landroid/net/nsd/NsdManager$ServiceInfoCallback;)V", "", ApiSince=37)]
public void RegisterServiceInfoCallback(Android.Net.Nsd.DiscoveryRequest discoveryRequest, Java.Util.Concurrent.IExecutor executor, Android.Net.Nsd.NsdManager.IServiceInfoCallback listener);
[<Android.Runtime.Register("registerServiceInfoCallback", "(Landroid/net/nsd/DiscoveryRequest;Ljava/util/concurrent/Executor;Landroid/net/nsd/NsdManager$ServiceInfoCallback;)V", "", ApiSince=37)>]
member this.RegisterServiceInfoCallback : Android.Net.Nsd.DiscoveryRequest * Java.Util.Concurrent.IExecutor * Android.Net.Nsd.NsdManager.IServiceInfoCallback -> unit

Parameters

discoveryRequest
DiscoveryRequest

the DiscoveryRequest object which specifies the discovery parameters such as service type, subtype and network. This value cannot be null.

executor
IExecutor

Executor to run listener callbacks with. This value cannot be null.

listener
NsdManager.IServiceInfoCallback

The listener to be notified of found, updated or lost services. This value cannot be null.

Attributes

Remarks

Register a callback to discover and track updates of services.

This method combines DiscoverServices(DiscoveryRequest, IExecutor, NsdManager+IDiscoveryListener) and RegisterServiceInfoCallback(NsdServiceInfo, IExecutor, NsdManager+IServiceInfoCallback). It finds services as specified by the request and continuously monitors their availability and properties.

This API automatically queries information for all discovered services, so it can cause more network traffic than discovery followed by callbacks for selected services. Most mDNS advertisers return full service information in one discovery reply; in that case, there is no additional traffic and this API avoids registering multiple listeners for discovery and resolution.

Cancel the registration before registering the same callback instance again. If the callback is already in use, this method throws IllegalArgumentException. Other registration failures are reported through OnServiceInfoCallbackRegistrationFailed(NsdFailure).

Android reference for android.net.nsd.NsdManager.registerServiceInfoCallback.

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

RegisterServiceInfoCallback(NsdServiceInfo, IExecutor, NsdManager+IServiceInfoCallback)

Register a callback to listen for updates to a service.

[Android.Runtime.Register("registerServiceInfoCallback", "(Landroid/net/nsd/NsdServiceInfo;Ljava/util/concurrent/Executor;Landroid/net/nsd/NsdManager$ServiceInfoCallback;)V", "", ApiSince=34)]
public void RegisterServiceInfoCallback(Android.Net.Nsd.NsdServiceInfo serviceInfo, Java.Util.Concurrent.IExecutor executor, Android.Net.Nsd.NsdManager.IServiceInfoCallback listener);
[<Android.Runtime.Register("registerServiceInfoCallback", "(Landroid/net/nsd/NsdServiceInfo;Ljava/util/concurrent/Executor;Landroid/net/nsd/NsdManager$ServiceInfoCallback;)V", "", ApiSince=34)>]
member this.RegisterServiceInfoCallback : Android.Net.Nsd.NsdServiceInfo * Java.Util.Concurrent.IExecutor * Android.Net.Nsd.NsdManager.IServiceInfoCallback -> unit

Parameters

serviceInfo
NsdServiceInfo

the service to receive updates for. This value cannot be null.

executor
IExecutor

Executor to run callbacks with. This value cannot be null.

listener
NsdManager.IServiceInfoCallback

to receive callback upon service update. This value cannot be null.

Attributes

Remarks

Register a callback to continuously monitor a service's availability. The callback methods run on the supplied executor, and updates are sent through OnServiceUpdated(NsdServiceInfo). In contrast, ResolveService(NsdServiceInfo, NsdManager+IResolveListener) provides service information once.

This API listens to updates for one service at a time. Cancel the registration before registering the same callback instance again. If the callback is already in use, this method throws IllegalArgumentException. Other registration failures are reported through OnServiceInfoCallbackRegistrationFailed(NsdFailure).

Android reference for android.net.nsd.NsdManager.registerServiceInfoCallback.

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