NsdManager.RegisterServiceInfoCallback Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| RegisterServiceInfoCallback(DiscoveryRequest, IExecutor, NsdManager+IServiceInfoCallback) |
Register a callback to discover and track updates of services. |
| RegisterServiceInfoCallback(NsdServiceInfo, IExecutor, NsdManager+IServiceInfoCallback) |
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,Executor,DiscoveryListener) and registerServiceInfoCallback(NsdServiceInfo,Executor,ServiceInfoCallback) by finding services as per the provided DiscoveryRequest, and continuously monitoring availability and properties of the discovered services.
This API may cause more network traffic than using discoverServices(DiscoveryRequest,Executor,DiscoveryListener) and only calling registerServiceInfoCallback(NsdServiceInfo,Executor,ServiceInfoCallback) for select services, because it automatically queries all service information for all discovered services. However most mDNS advertisers reply with their full service information in one discovery reply, in which case there is no additional traffic, and this API saves the cost of registering multiple listeners for discovering and resolving services.
Applications need to cancel the registration before registering the same callback instance again. Upon failure to register a callback, the application is notified through ServiceInfoCallback.onServiceInfoCallbackRegistrationFailed.
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)
[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
- executor
- IExecutor
- listener
- NsdManager.IServiceInfoCallback
- Attributes