本文介绍了如何获取当前单元格的信号强度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想存储单元格的信号强度,和我做这样的:
I would like to store the cell signal strength, and i do it like this:
private class GetRssi extends PhoneStateListener {
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(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?
推荐答案
有getAllCellInfo()在TelephonyManager方法添加API 17,可能是很好的解决方案。使用示例:
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();
cellSignalStrengthGsm.getDbm();
这篇关于如何获取当前单元格的信号强度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!