Stay organized with collections
Save and categorize content based on your preferences.
DiscoveryListener
interface DiscoveryListener
Interface for callback invocation for service discovery
Summary
Public methods
onDiscoveryStarted
abstract fun onDiscoveryStarted(serviceType: String!): Unit
onDiscoveryStopped
abstract fun onDiscoveryStopped(serviceType: String!): Unit
onStartDiscoveryFailed
abstract fun onStartDiscoveryFailed(
serviceType: String!,
errorCode: Int
): Unit
onStopDiscoveryFailed
abstract fun onStopDiscoveryFailed(
serviceType: String!,
errorCode: Int
): Unit
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 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# NsdManager.DiscoveryListener\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nDiscoveryListener\n=================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/net/nsd/NsdManager.DiscoveryListener \"View this page in Java\") \n\n```\ninterface DiscoveryListener\n```\n\n|---------------------------------------------------|\n| [android.net.nsd.NsdManager.DiscoveryListener](#) |\n\nInterface for callback invocation for service discovery\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onDiscoveryStarted](#onDiscoveryStarted(kotlin.String))`(`serviceType:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` \u003cbr /\u003e |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onDiscoveryStopped](#onDiscoveryStopped(kotlin.String))`(`serviceType:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` \u003cbr /\u003e |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onServiceFound](#onServiceFound(android.net.nsd.NsdServiceInfo))`(`serviceInfo:` `[NsdServiceInfo](/reference/kotlin/android/net/nsd/NsdServiceInfo)!`)` \u003cbr /\u003e |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onServiceLost](#onServiceLost(android.net.nsd.NsdServiceInfo))`(`serviceInfo:` `[NsdServiceInfo](/reference/kotlin/android/net/nsd/NsdServiceInfo)!`)` \u003cbr /\u003e |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onStartDiscoveryFailed](#onStartDiscoveryFailed(kotlin.String,%20kotlin.Int))`(`serviceType:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `errorCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` \u003cbr /\u003e |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onStopDiscoveryFailed](#onStopDiscoveryFailed(kotlin.String,%20kotlin.Int))`(`serviceType:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `errorCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` \u003cbr /\u003e |\n\nPublic methods\n--------------\n\n### onDiscoveryStarted\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onDiscoveryStarted(serviceType: String!): Unit\n``` \n\n### onDiscoveryStopped\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onDiscoveryStopped(serviceType: String!): Unit\n``` \n\n### onServiceFound\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onServiceFound(serviceInfo: NsdServiceInfo!): Unit\n``` \n\n### onServiceLost\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onServiceLost(serviceInfo: NsdServiceInfo!): Unit\n``` \n\n### onStartDiscoveryFailed\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onStartDiscoveryFailed(\n serviceType: String!, \n errorCode: Int\n): Unit\n``` \n\n### onStopDiscoveryFailed\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onStopDiscoveryFailed(\n serviceType: String!, \n errorCode: Int\n): Unit\n```"]]