Search code examples
androidsignal-strength

How is telephony signal strength updated to UI in android


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?


Solution

  • 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