我用cellInfo得到了四个参数:rssi、rsrp、rsrq和sinr。我找不到解决此问题的正确解决方案。有人知道如何获取 CellInfo 吗?我目前正在使用安卓模拟器。我的清单权限:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
代码:
TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
cellInfoList = tm.getAllCellInfo();
for (CellInfo cellInfo : cellInfoList) {
if (cellInfo instanceof CellInfoLte) {
rssi = ((CellInfoLte) cellInfo).getCellSignalStrength().getRssi();
rsrp = ((CellInfoLte) cellInfo).getCellSignalStrength().getRsrp();
rsrq = ((CellInfoLte) cellInfo).getCellSignalStrength().getRsrq();
snr = ((CellInfoLte) cellInfo).getCellSignalStrength().getRssnr();
}
}
rssiValue.setText(String.valueOf(rssi));
rsrpValue.setText(String.valueOf(rsrp));
rsrqValue.setText(String.valueOf(rsrq));
sinr.setText(String.valueOf(snr));