randms26
randms26

Reputation: 137

What does android Wifi ScanResult.level value means?

I'm trying to make an app that can measure of a detected Wifi signal strength.

i'm using this code

for (int i=0; i<size; i++){
   ScanResult scanresult = wifi.getScanResults().get(i);
   int rssi = scanresult.level;
}

what i want to ask is, since the result is always negative (-67, -88, -90, etc), what is the value means? is it the loss, or is it the received signal level?

thanks for the answer

Upvotes: 1

Views: 3365

Answers (3)

Derek Baker
Derek Baker

Reputation: 86

You could use calculateSignalLevel method form WifiManager like this:

int range = 5; //the range of integers you want to match the level (in this case it will be from 0 to 4)

int signalStrength = WifiManager.calculateSignalLevel(rssi, range);

You can visit this source.

Upvotes: 2

M M
M M

Reputation: 21

-49, -47 means that the signal is very good like documentations based on dBm say.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1007359

Quoting the documentation for level:

The detected signal level in dBm. At least those are the units used by the TI driver.

Quoting an old alt.internet.wireless post:

The reason you see negative values is that you're representing small but positive numbers, on a logarithmic scale. In logarithms, the value indicated represents an exponent... for example, under a log 10 scale, a value of -2 represents 10 to the -2 power, which equals 0.01. Likewise, a negative dBm means that you're applying a negative exponent in your power calculations; 0 dBm equals 1 mW of power, so -10 dBm equates to 0.1 mW, -20 dBm equates to 0.01 mW, and so forth. It's a lot easier, and more useful in some calculations, to describe a weak signal as -100 dBm as opposed to 0.0000000001 mW.

Upvotes: 2

Related Questions