What rssi means in android WifiManager

I am trying to get the signal strength of the current wifi connection using getRssi()

 private void checkWifi(){ ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo Info = cm.getActiveNetworkInfo(); if (Info == null || !Info.isConnectedOrConnecting()) { Log.i("WIFI CONNECTION", "No connection"); } else { int netType = Info.getType(); int netSubtype = Info.getSubtype(); if (netType == ConnectivityManager.TYPE_WIFI) { wifiManager = (WifiManager)getApplicationContext().getSystemService(Context.WIFI_SERVICE); int linkSpeed = wifiManager.getConnectionInfo().getLinkSpeed(); int rssi = wifiManager.getConnectionInfo().getRssi(); Log.i("WIFI CONNECTION", "Wifi connection speed: "+linkSpeed + " rssi: "+rssi); //Need to get wifi strength } } } 

The thing is, I get numbers like -35 or -47 ect .. and I don't understand their meanings. I looked at the Android documentation and all that it says is:

public int getRssi ()

Since: API Level 1 Returns the received signal strength indicator of the current 802.11 network.

This is not normal, but it should be!

Returns RSSI in range? to

can someone explain how to "normalize" or understand these results?

+7
source share
4 answers

According to IEEE 802.11 documentation : smaller negative values ​​mean higher signal strength.

The range is from -100 to 0 dBm, closer to 0 - higher power and vice versa.

+6
source

I found this in WifiManager.java :

 /** Anything worse than or equal to this will show 0 bars. */ private static final int MIN_RSSI = -100; /** Anything better than or equal to this will show the max bars. */ private static final int MAX_RSSI = -55; 

The relevant rssi range for Android is -100 and -55 .

There is this static WifiManager.calculateSignalLevel method (rssi, numLevel) that will calculate the signal level for you:

 int wifiLevel = WifiManager.calculateSignalLevel(rssi,5); 

returns a number from 0 to 4 (i.e. numLevel-1): the number of bars displayed on the toolbar.

+11
source

From Wikipedia:

Suppliers provide their own accuracy, granularity and range for actual power (measured as mW or dBm) and their range of RSSI values ​​(0 to RSSI_Max).

As an example, Cisco Systems cards are set to RSSI_Max 100 and will report 101 power levels, where the RSSI value is 0 100. Atheros is another popular Wi-Fi chipset. An Atheros-based map will return an RSSI value of 0 to 127 (0x7f) from 128 (0x80), indicating an invalid value.

So it depends a lot on the equipment.

0
source

starting with ben75's answer, we can use this method to normalize rssi:

 public static int normalizeRssi(int rssi){ // Anything worse than or equal to this will show 0 bars final int MIN_RSSI = -100; // Anything better than or equal to this will show the max bars. final int MAX_RSSI = -55; int range = MAX_RSSI - MIN_RSSI; return 100 - ((MAX_RSSI - rssi) * 100 / range); } 
0
source

All Articles