ServiceInfoCallback


interface ServiceInfoCallback
android.net.nsd.NsdManager.ServiceInfoCallback

Callback to listen to service info updates. For use with NsdManager#registerServiceInfoCallback to register, and with NsdManager#unregisterServiceInfoCallback to stop listening.

Summary

Public methods
abstract Unit

Reports that registering the callback failed with an error.

abstract Unit

Reports that service info updates have stopped.

abstract Unit

Reports when the service that this callback listens to becomes unavailable.

abstract Unit

Reports updated service info.

Public methods

onServiceInfoCallbackRegistrationFailed

abstract fun onServiceInfoCallbackRegistrationFailed(errorCode: Int): Unit

Reports that registering the callback failed with an error. Called on the executor passed to NsdManager#registerServiceInfoCallback. onServiceInfoCallbackRegistrationFailed will be called exactly once when the callback could not be registered. No other callback will be sent in that case.

Parameters
errorCode Int: Value is android.net.nsd.NsdManager#FAILURE_ALREADY_ACTIVE, or android.net.nsd.NsdManager#FAILURE_BAD_PARAMETERS

onServiceInfoCallbackUnregistered

abstract fun onServiceInfoCallbackUnregistered(): Unit

Reports that service info updates have stopped. Called on the executor passed to NsdManager#registerServiceInfoCallback. A callback unregistration operation will call onServiceInfoCallbackUnregistered once. After this, the callback may be reused.

onServiceLost

abstract fun onServiceLost(): Unit

Reports when the service that this callback listens to becomes unavailable. Called on the executor passed to NsdManager#registerServiceInfoCallback. The service may become available again, in which case onServiceUpdated will be called.

onServiceUpdated

abstract fun onServiceUpdated(serviceInfo: NsdServiceInfo): Unit

Reports updated service info. Called on the executor passed to NsdManager#registerServiceInfoCallback. Any service updates will be notified via this callback until NsdManager#unregisterServiceInfoCallback is called. This will only be called once the service is found, so may never be called if the service is never present.

Parameters
serviceInfo NsdServiceInfo: This value cannot be null.