Get RSRP from CellSignalStrengthLte for Android app API 17+

后端 未结 3 1657
执笔经年
执笔经年 2021-01-07 03:51

A few people over the past decade have asked similar questions but none have ANY answers. I need to write an android app that collects and stores RSRP, RSRQ, CINR, and Cell

3条回答
  •  情话喂你
    2021-01-07 04:05

    At the beginning I encountered with cases when Cell Info is null, not allowed to access Cell Info and so on. Finally I found a way to get parameters from LTE. This code works for me to get parameters like: rsrp, rsrq and sinr. I hope it will work for you also.

    List cellInfoList;
    TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
    cellInfoList = tm.getSignalStrength().getCellSignalStrengths();
        for (CellSignalStrength cellInfo : cellInfoList) {
            if (cellInfo instanceof CellSignalStrengthLte) {
                rsrp = ((CellSignalStrengthLte) cellInfo).getRsrp();
                rsrq = ((CellSignalStrengthLte) cellInfo).getRsrq();
                snr = ((CellSignalStrengthLte) cellInfo).getRssnr();
    
            }
        }
        rsrpValue.setText(String.valueOf(rsrp));
        rsrqValue.setText(String.valueOf(rsrq));
        sinr.setText(String.valueOf(snr));
    

    My Manifest permissions:

    
    
    
    

提交回复
热议问题