I want to discover my PC's IP from my Android Phone and connect to a local server running at a particular port. Used the Fing tool and it shows the device name and their IP addresses.
How do I implement this in Android 10 and above?
Since arp scanning is no longer allowed by Android 10.
I tried ip neigh show
but it returns an empty string.
val runtime = Runtime.getRuntime()
val proc = runtime.exec("ip neigh show")
proc.waitFor()
val reader = BufferedReader(InputStreamReader(proc.inputStream))
val array = reader.lines().toArray()
Is this a good approach or should i host the server on my phone and scan my phone from PC?
Android API 30 or higher curtails the "ip" command, unfortunately, also in the name of protecting MAC addresses