Nilesh Tupe Nilesh Tupe - 6 months ago 21
Android Question

How to get IP address of the device?

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

Answer

This worked for me:

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