LocalNetworkAccess

fun interface LocalNetworkAccess(source)

Whether the platform currently permits opening a socket to a local-network address.

Android 17 (API 37) gates local-network traffic behind ACCESS_LOCAL_NETWORK, and the gate is on the socket rather than on discovery: a blocked TCP connect does not fail fast, it times out. The service reconnects to a persisted device address at startup with no UI in sight, so without this check a TCP user who has not granted the permission simply waits out a socket timeout with nothing to explain it.

A service has no Activity, so it cannot request the permission — it can only decline to try and say why. The request itself belongs to ConnectionsScreen.

Implementations are per-platform and granted-by-construction everywhere the concept does not apply.

Inheritors

Functions

Link copied to clipboard
abstract fun isGranted(): Boolean