First, here's my code for getting lte rsrp (or other) values. This code piece runs on another aysncTask.
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
int tempInt;
while (isRunning) {
try {
List<CellInfo> cellInfoList = tm.getAllCellInfo();
if (cellInfoList != null && cellInfoList.size() != 0) {
msg = handler.obtainMessage();
CellInfo cellInfo = cellInfoList.get(0);
result = -9999;
tempInt = 0;
if (cellInfo instanceof CellInfoWcdma) {
result = ((CellInfoWcdma) cellInfo).getCellSignalStrength().getDbm();
Log.e(TAG, "3G : " + result + "");
} else if (cellInfo instanceof CellInfoLte) {
result = ((CellInfoLte) cellInfo).getCellSignalStrength().getDbm();
Log.e(TAG, "LTE : " + result);
} else if (cellInfo instanceof CellInfoGsm) {
result = ((CellInfoGsm) cellInfo).getCellSignalStrength().getDbm();
Log.e(TAG, "GSM" + result);
} else if (cellInfo instanceof CellInfoCdma) {
result = ((CellInfoCdma) cellInfo).getCellSignalStrength().getDbm();
Log.e(TAG, "CDMA" + result);
}
.....
The problem is, I am not sure the data I'm getting is correct.
While I make this source run on background to see the rsrp value, I run the hidden menu of my LG G3 using the command *123456#. It shows a debug mode showing the realtime rsrp value.
The issue is, the rsrp I'm getting on my app's log and the one on the hidden menu is different in most cases. My app shows about -3 ~ +3 more.
Why is this happenning? Is there something wrong with my code? The above code has no time intervals and will continue before I force close the application.