过去十年来,有几个人提出了类似的问题,但没有人有任何答案。我需要编写一个android应用程序来收集和存储rsrp、rsrq、cinr和手机id。答案需要尽可能精确,因为我需要对这些值进行后期处理统计(我正在三星galaxy s5上进行测试)。
有人知道如何使用电话管理器或CellSignalStrengthlet来获取RSRP吗?或者还有其他更好的方法来获得rsrp吗?
到目前为止,我所能做的最好的事情是使用phoneStateListener和telephonymanager来获取rssi值,但是rssi对于我的统计数据是无用的:
package com.pscr.jparks.signalstrength;
import android.app.Activity;
import android.os.Bundle;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.widget.TextView;
/*
TS 27.007 8.5
Defined values
<rssi>:
0 -113 dBm or less
1 -111 dBm
2...30 -109... -53 dBm
31 -51 dBm or greater
99 not known or not detectable
*/
public class SignalStrengthActivity extends Activity {
SignalStrengthListener signalStrengthListener;
TextView signalStrengthTextView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setup content stuff
this.setContentView(R.layout.signal_strength);
signalStrengthTextView = (TextView) findViewById(R.id.signalStrengthTextView);
//start the signal strength listener
signalStrengthListener = new SignalStrengthListener();
((TelephonyManager) getSystemService(TELEPHONY_SERVICE)).listen(signalStrengthListener, SignalStrengthListener.LISTEN_SIGNAL_STRENGTHS);
}
private class SignalStrengthListener extends PhoneStateListener {
@Override
public void onSignalStrengthsChanged(android.telephony.SignalStrength signalStrength) {
// get the signal strength (a value between 0 and 31)
int strengthAmplitude = signalStrength.getGsmSignalStrength();
//do something with it (in this case we update a text view)
signalStrengthTextView.setText(String.valueOf(strengthAmplitude));
super.onSignalStrengthsChanged(signalStrength);
}
}
}
如果有人解决了这个问题,或者找到了答案(我到处找过!),请告诉我!
最佳答案
更新:
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
List<CellInfo> cellInfoList = tm.getAllCellInfo();
for (CellInfo cellInfo : cellInfoList)
{
if (cellInfo instanceof CellInfoLte)
{
// cast to CellInfoLte and call all the CellInfoLte methods you need
((CellInfoLte)cellInfo).getCellSignalStrength().getDbm();
}
}