Skip to content

Instantly share code, notes, and snippets.

@btwarog
Last active December 7, 2022 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btwarog/5381e70908600dd79dd4b0a0df5e8ccb to your computer and use it in GitHub Desktop.
Save btwarog/5381e70908600dd79dd4b0a0df5e8ccb to your computer and use it in GitHub Desktop.
IPv4 Addresses Android Kotlin
NetworkInterface.getNetworkInterfaces().asSequence().forEach { nInterface ->
println("IPv4 address ${nInterface.displayName} ${nInterface.interfaceAddresses.filter { it.address is Inet4Address }.joinToString { it.address.hostAddress }}")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment