public static interface NsdManager.ResolveListener

android.net.nsd.NsdManager.ResolveListener



Callback for use with NsdManager.resolveService to resolve the service info and use with NsdManager.stopServiceResolution to stop resolution.

Summary

Public methods

default void onResolutionStopped(NsdServiceInfo serviceInfo)

Called on the internal thread or with an executor passed to NsdManager.resolveService to report the resolution was stopped.

abstract void onResolveFailed(NsdServiceInfo serviceInfo, int errorCode)

Called on the internal thread or with an executor passed to NsdManager.resolveService to report the resolution was failed with an error.

abstract void onServiceResolved(NsdServiceInfo serviceInfo)

Called on the internal thread or with an executor passed to NsdManager.resolveService to report the resolved service info.

default void onStopResolutionFailed(NsdServiceInfo serviceInfo, int errorCode)

Called once on the internal thread or with an executor passed to NsdManager.resolveService to report that stopping resolution failed with an error.

Public methods

onResolutionStopped

public void onResolutionStopped (NsdServiceInfo serviceInfo)

Called on the internal thread or with an executor passed to NsdManager.resolveService to report the resolution was stopped. A stop resolution operation would call either onResolutionStopped or onStopResolutionFailed once based on the result.

Parameters
serviceInfo NsdServiceInfo: This value cannot be null.

onResolveFailed

public abstract void onResolveFailed (NsdServiceInfo serviceInfo, 
                int errorCode)

Called on the internal thread or with an executor passed to NsdManager.resolveService to report the resolution was failed with an error. A resolution operation would call either onServiceResolved or onResolveFailed once based on the result.

Parameters
serviceInfo NsdServiceInfo
errorCode int

onServiceResolved

public abstract void onServiceResolved (NsdServiceInfo serviceInfo)

Called on the internal thread or with an executor passed to NsdManager.resolveService to report the resolved service info. A resolution operation would call either onServiceResolved or onResolveFailed once based on the result.

Parameters
serviceInfo NsdServiceInfo

onStopResolutionFailed

public void onStopResolutionFailed (NsdServiceInfo serviceInfo, 
                int errorCode)

Called once on the internal thread or with an executor passed to NsdManager.resolveService to report that stopping resolution failed with an error. A stop resolution operation would call either onResolutionStopped or onStopResolutionFailed once based on the result.

Parameters
serviceInfo NsdServiceInfo: This value cannot be null.
errorCode int: Value is one of the following:

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-02-13 UTC.