Display Android's getGsmSignalStrength() value in percentage

PC. picture PC. · Oct 16, 2011 · Viewed 8k times · Source

According to the corresponding dBm values of getGsmSignalStrength(), the scale appears to be linear. (See dBm values here). But I've observed that in almost all applications, this scale is not used as linear scale.

For example consider Android's src StatusBarPolicy::updateSignalStrength

signal strength = 0 or 99 -> no signal
signal strength >= 12 -> very good signal
signal strength >= 8 -> good signal
signal strength >= 5 -> poor signal
signal strength <5 -> very poor signal

can anyone help me find out the scale using which i can display the signal strength in percentage.

Answer

brianestey picture brianestey · Oct 16, 2011

From the link you provided:

0 -113 dBm or less
1 -111 dBm
2...30 -109... -53 dBm
31 -51 dBm or greater

99 not known or not detectable

This would mean you have a range or -113 to -51, or -62dBm. To convert that to a percentage, you can take the value you receive (0-31,99), figure out what the corresponding dBm is, and then find the difference with -113 and divide by 62.

For example, 0=-113dBm. Difference with -113 = 0. 0/62 = 0%. 1=-111dBm. Difference with -113 = 2. 2/62 ~ 3%. 30=-53dBm. Difference with -113 = 60. 60/62 ~97%.

The only special case you need is for 99, which should be handled like 0.