package com.ultron.jarvistv import android.content.Context import java.net.NetworkInterface object NetUtil { /** Best-effort local IPv4 so the UI can show where to send commands. */ fun localIp(ctx: Context): String? { try { for (nif in NetworkInterface.getNetworkInterfaces()) { for (addr in nif.inetAddresses) { if (!addr.isLoopbackAddress && addr.hostAddress?.contains('.') == true) { return addr.hostAddress } } } } catch (_: Exception) {} return null } }