Search code examples
androidandroid-wifi

What's the meaning of Rssi 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
        } 
    }
}

thing is i get numbers like -35 or -47 ect.. and i don't understand their values.. I have looked at the android documentation and all it states:

public int getRssi ()

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

This is not normalized, but should be!

Returns the RSSI, in the range ??? to ???

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


Solution

  • According to IEEE 802.11 documentation: Lesser negative values denotes higher signal strength.

    The range is between -100 to 0 dBm, closer to 0 is higher strength and vice-versa.