VJgh VJgh - 3 months ago 22
Android Question

Get IP and name of devices on WIFI

I'm working on a little application, the first step is to get IP and name of all devices connected to my wifi.
Actually I'm able to get only the BSSID of some devices in my wifi but not all

code is:

WifiManager wifi = (WifiManager)getSystemService(Context.WIFI_SERVICE);
List<ScanResult> a=wifi.getScanResults();
int j=0;

while(j<a.size()){
System.out.println(a.get(j).SSID);
j++;
}


how can I get what i want?

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

called Android Network Discovery and interested developers can get its source code from github repo