javaandroidtelephonymanagerphone-state-listenerlte

Get RSRP from CellSignalStrengthLte for Android app API 17+


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 ID. The answers need to be as accurate as the phones hardware allows (I am testing on Samsung Galaxy S5) because I need to do post processing statistics with those values.

Does anyone know how to use telephonyManager or CellSignalStrengthLte to get RSRP? Or is there another, perhaps better way to get RSRP?

So far the best that I have been able to do is use a PhoneStateListener and TelephonyManager to get the RSSI values, but RSSI is useless for my statistics:

    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);
            }
        }
    }

If anyone has solved this problem, or found an answer (I have looked everywhere!), please let me know!


Solution

  • Update:

    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();
        }
    }