Skip to content

Instantly share code, notes, and snippets.

@stickupkid
Created September 29, 2011 13:36
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stickupkid/1250733 to your computer and use it in GitHub Desktop.
Save stickupkid/1250733 to your computer and use it in GitHub Desktop.
Get wifi ip address for android
WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
int ipAddress = wifiInfo.getIpAddress();
String ipString = String.format(“%d.%d.%d.%d”, (ip & 0xff), (ip >> 8 & 0xff), (ip >> 16 & 0xff), (ip >> 24 & 0xff));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment