Adam Varhegyi Adam Varhegyi - 1 year ago 142
Android Question

How to get current cell signal strength?

I would like to store the cell signal strength, and i do it like this:

private class GetRssi extends PhoneStateListener {
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
Variables.signal = signalStrength.getGsmSignalStrength();



Okay but this only runs if it changes. I need the current signal strength.

Is there a method to just ask for the current signal strength?

Answer Source

There is getAllCellInfo() method in TelephonyManager added in API 17 that could be good solution. Example of use:

TelephonyManager telephonyManager = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
// for example value of first element
CellInfoGsm cellinfogsm = (CellInfoGsm)telephonyManager.getAllCellInfo().get(0);
CellSignalStrengthGsm cellSignalStrengthGsm = cellinfogsm.getCellSignalStrength();