如何获得设备的IP地址?

如何获得设备的IP地址?

问题描述:

是否有可能使用一些code来获得设备的IP地址?

Is it possible to get the IP address of the device using some code?

这为我工作:

WifiManager wm = (WifiManager) getSystemService(WIFI_SERVICE);
String ip = Formatter.formatIpAddress(wm.getConnectionInfo().getIpAddress());