When an Android device connects to a wifi AP, it identifies itself with a name like:
android_cc1dec12345e6054
How can that string be obtained from within an Andr
I used jiangze ren's answer and modified it.
Now you can get hostname by getting IP address of device:
WifiManager wm = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
final String ip = Formatter.formatIpAddress(wm.getConnectionInfo().getIpAddress());
InetAddress address = InetAddress.getByName(ip);
System.out.println(address.getHostName()); // <-- host name is here and not localhost!