5

I am trying to make a simple app that tells me the rssi values of the 5 strongest wifi networks. I don't need to connect to any of the networks, just want to know the rssi's. At the moment I'm using the following bit of code:

wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
int info = wifi.getConnectionInfo().getRssi();
textStatus.setText("WiFi Rssi: " + info);

However, this only displays the rssi value of the network I am connected to.

Is there a way of getting this information for other networks?

rekire
  • 47,260
  • 30
  • 167
  • 264
Nico
  • 109
  • 1
  • 5

1 Answers1

5

I think I got it:

ScanResult result0 = wifi.getScanResults().get(0);
String ssid0 = result0.SSID;
int rssi0 = result0.level;
String rssiString0 = String.valueOf(rssi0);
textStatus.append("\n" + ssid0 + "   " + rssiString0);

then get(1), get(2) and so on for however many you like

Nico
  • 109
  • 1
  • 5
  • 1
    The level property is the RSSI, which, according to the documentation, is measured in dBm. ([docs](http://developer.android.com/reference/android/net/wifi/ScanResult.html#level)) – AI0867 Jun 02 '15 at 15:36