-1

i went though the following post to get the signal strength in android:

How to get cell service signal strength in Android?

my ques is that: how does the signal strength gets updated to the system UI. what does each bar in the strength meter signify? is there a particular threshold value for each bar?

Community
  • 1
  • 1
Sid
  • 79
  • 1
  • 9

2 Answers2

2

The signal strength icon is controlled from SystemUI. It might differ in other Android versions, but in KitKat the NetworkController.java class handles which icon is shown. The SignalStrength.java is the class that returns to NetworkController.java what the current signal strength is. The signal strength is represented as a number between 0 (no signal) and 4 (great signal). The actual signal is measured in dBm, and is passed into the SignalStrength.java class as a Parcel from the (low level) radio interface layer (RIL) of the Android framework. The actual thresholds differs between the different radio technologies used.

hanspeide
  • 2,819
  • 4
  • 25
  • 33
  • Thank you for your answer @hanspeide. If i am not wrong, the function, updateTelephonySignalStrength() actually updates the strength to the signal icon in the UI. – Sid Sep 17 '14 at 08:40
  • Suppose we use WCDMA technology, and RIL sends a parcel to SignalStrength.java. Now this parcel contains a signal strength which is to be updated to the UI. How is it determined wether the strenght is low, medium or high? – Sid Sep 17 '14 at 08:54
  • 1
    SignalStrength.java does the conversion from dBm into a value from 0 to 4. – hanspeide Sep 17 '14 at 11:09
1

The getGsmLevel() function in SignalStrength.java does the trick here:

int level;
int asu = getGsmSignalStrength();
if (asu <= 2 || asu == 99) level = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
else if (asu >= 12) level = SIGNAL_STRENGTH_GREAT;
else if (asu >= 8)  level = SIGNAL_STRENGTH_GOOD;
else if (asu >= 5)  level = SIGNAL_STRENGTH_MODERATE;
else level = SIGNAL_STRENGTH_POOR;

this function returns the level

Sid
  • 79
  • 1
  • 9