LanDiscoverer

actual class LanDiscoverer(serviceType: String)

Discovers services of serviceType advertised on the local network.

discover returns a cold Flow that emits a LanHost each time a new host is found (de-duplicated by host+port+payload for the lifetime of the collection). Cancelling the collector tears down the platform listener. The JVM actual additionally sends a one-shot UDP "probe" so already-advertising hosts answer immediately rather than only on their next beacon tick.

Permissions the consuming app must declare

This is a library module with no manifest of its own, so nothing here is declared for you.

  • Android 17 / API 37 and aboveandroid.permission.ACCESS_LOCAL_NETWORK is a runtime permission gating mDNS/DNS-SD, local-network scanning and casting. Discovery returns no results without it. Declare it in the manifest and request it at runtime before collecting, exactly as you would for location or camera. This bites when you move targetSdk to 37, not when you compile against it.

  • iOS 14 and aboveNSLocalNetworkUsageDescription plus an NSBonjourServices entry naming the service type, both in Info.plist. Bonjour silently finds nothing if either is missing.

  • All Android versionsINTERNET.

The Android actual carries @SuppressLint("MissingPermission") because a library module cannot declare what its consumer must request. That suppression is not a claim that no permission is needed; on API 37 it would be an actively wrong one.

expect class LanDiscoverer(serviceType: String)

Discovers services of serviceType advertised on the local network.

discover returns a cold Flow that emits a LanHost each time a new host is found (de-duplicated by host+port+payload for the lifetime of the collection). Cancelling the collector tears down the platform listener. The JVM actual additionally sends a one-shot UDP "probe" so already-advertising hosts answer immediately rather than only on their next beacon tick.

Permissions the consuming app must declare

This is a library module with no manifest of its own, so nothing here is declared for you.

  • Android 17 / API 37 and aboveandroid.permission.ACCESS_LOCAL_NETWORK is a runtime permission gating mDNS/DNS-SD, local-network scanning and casting. Discovery returns no results without it. Declare it in the manifest and request it at runtime before collecting, exactly as you would for location or camera. This bites when you move targetSdk to 37, not when you compile against it.

  • iOS 14 and aboveNSLocalNetworkUsageDescription plus an NSBonjourServices entry naming the service type, both in Info.plist. Bonjour silently finds nothing if either is missing.

  • All Android versionsINTERNET.

The Android actual carries @SuppressLint("MissingPermission") because a library module cannot declare what its consumer must request. That suppression is not a claim that no permission is needed; on API 37 it would be an actively wrong one.

actual class LanDiscoverer(serviceType: String)

Discovers services of serviceType advertised on the local network.

discover returns a cold Flow that emits a LanHost each time a new host is found (de-duplicated by host+port+payload for the lifetime of the collection). Cancelling the collector tears down the platform listener. The JVM actual additionally sends a one-shot UDP "probe" so already-advertising hosts answer immediately rather than only on their next beacon tick.

Permissions the consuming app must declare

This is a library module with no manifest of its own, so nothing here is declared for you.

  • Android 17 / API 37 and aboveandroid.permission.ACCESS_LOCAL_NETWORK is a runtime permission gating mDNS/DNS-SD, local-network scanning and casting. Discovery returns no results without it. Declare it in the manifest and request it at runtime before collecting, exactly as you would for location or camera. This bites when you move targetSdk to 37, not when you compile against it.

  • iOS 14 and aboveNSLocalNetworkUsageDescription plus an NSBonjourServices entry naming the service type, both in Info.plist. Bonjour silently finds nothing if either is missing.

  • All Android versionsINTERNET.

The Android actual carries @SuppressLint("MissingPermission") because a library module cannot declare what its consumer must request. That suppression is not a claim that no permission is needed; on API 37 it would be an actively wrong one.

actual class LanDiscoverer(serviceType: String)

Discovers services of serviceType advertised on the local network.

discover returns a cold Flow that emits a LanHost each time a new host is found (de-duplicated by host+port+payload for the lifetime of the collection). Cancelling the collector tears down the platform listener. The JVM actual additionally sends a one-shot UDP "probe" so already-advertising hosts answer immediately rather than only on their next beacon tick.

Permissions the consuming app must declare

This is a library module with no manifest of its own, so nothing here is declared for you.

  • Android 17 / API 37 and aboveandroid.permission.ACCESS_LOCAL_NETWORK is a runtime permission gating mDNS/DNS-SD, local-network scanning and casting. Discovery returns no results without it. Declare it in the manifest and request it at runtime before collecting, exactly as you would for location or camera. This bites when you move targetSdk to 37, not when you compile against it.

  • iOS 14 and aboveNSLocalNetworkUsageDescription plus an NSBonjourServices entry naming the service type, both in Info.plist. Bonjour silently finds nothing if either is missing.

  • All Android versionsINTERNET.

The Android actual carries @SuppressLint("MissingPermission") because a library module cannot declare what its consumer must request. That suppression is not a claim that no permission is needed; on API 37 it would be an actively wrong one.

actual class LanDiscoverer(serviceType: String)

Discovers services of serviceType advertised on the local network.

discover returns a cold Flow that emits a LanHost each time a new host is found (de-duplicated by host+port+payload for the lifetime of the collection). Cancelling the collector tears down the platform listener. The JVM actual additionally sends a one-shot UDP "probe" so already-advertising hosts answer immediately rather than only on their next beacon tick.

Permissions the consuming app must declare

This is a library module with no manifest of its own, so nothing here is declared for you.

  • Android 17 / API 37 and aboveandroid.permission.ACCESS_LOCAL_NETWORK is a runtime permission gating mDNS/DNS-SD, local-network scanning and casting. Discovery returns no results without it. Declare it in the manifest and request it at runtime before collecting, exactly as you would for location or camera. This bites when you move targetSdk to 37, not when you compile against it.

  • iOS 14 and aboveNSLocalNetworkUsageDescription plus an NSBonjourServices entry naming the service type, both in Info.plist. Bonjour silently finds nothing if either is missing.

  • All Android versionsINTERNET.

The Android actual carries @SuppressLint("MissingPermission") because a library module cannot declare what its consumer must request. That suppression is not a claim that no permission is needed; on API 37 it would be an actively wrong one.

Constructors

Link copied to clipboard
actual constructor(serviceType: String)
expect constructor(serviceType: String)
actual constructor(serviceType: String)
actual constructor(serviceType: String)
actual constructor(serviceType: String)

Functions

Link copied to clipboard
actual fun discover(): Flow<LanHost>

ponytail: @SuppressLint("MissingPermission") is kept, but it is NOT a statement that no permission is needed — NSD discovery has always wanted INTERNET plus (historically) CHANGE_WIFI_MULTICAST_STATE, and Android 17 (API 37) introduces ACCESS_LOCAL_NETWORK as a runtime permission gating mDNS/DNS-SD outright. The suppression exists because this is a library module with no manifest of its own; the consuming app declares and requests. Left in place so the module still lints clean, documented here so the next reader does not mistake it for "no permission required" — which is exactly what it would have meant on API 37.

expect fun discover(): Flow<LanHost>
actual fun discover(): Flow<LanHost>
actual fun discover(): Flow<LanHost>
actual fun discover(): Flow<LanHost>