Nilesh Tupe Nilesh Tupe - 1 year ago 88
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 Source

This worked for me:

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