Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get LTE signal strength in Android?

I am using Verizon's new LTE handset from HTC Thunderbolt. I cannot find the API to query for the signal strength while the handset is on LTE. By entering the field test mode (##4636##), I can see signal strength as -98dBm 2 asu. Anyone know what API I could use to get this info?

like image 483
Dillon Jay Avatar asked Apr 04 '11 22:04

Dillon Jay


People also ask

What does 3001 12345 do to your phone?

Dial *3001#12345#* and press the Call button. This will launch the Field Test Mode app and where the bars/dots were in the top left corner of the screen, you'll now see a negative number. The negative number is the decibel signal strength reading and should be followed by the carrier name and then the network type.

What is a good 4G LTE signal strength?

Excellent signal strength for 4G is around -90 dBm.


1 Answers

Warning : this solution should work for Android below API17. Some people may have troubles with newer api or specific phone brand (like Huawei)

You need to use this code. In fact, all the information you need is here :

String ssignal = signalStrength.toString();

String[] parts = ssignal.split(" ");

The parts[] array will then contain these elements:

part[0] = "Signalstrength:"  _ignore this, it's just the title_

parts[1] = GsmSignalStrength

parts[2] = GsmBitErrorRate

parts[3] = CdmaDbm

parts[4] = CdmaEcio

parts[5] = EvdoDbm

parts[6] = EvdoEcio

parts[7] = EvdoSnr

parts[8] = LteSignalStrength

parts[9] = LteRsrp

parts[10] = LteRsrq

parts[11] = LteRssnr

parts[12] = LteCqi

parts[13] = gsm|lte|cdma

parts[14] = _not really sure what this number is_

So, LTEdBm is :

TelephonyManager tm = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);

int dbm = 0;

if ( tm.getNetworkType() == TelephonyManager.NETWORK_TYPE_LTE){

    // For Lte SignalStrength: dbm = ASU - 140.
    dbm = Integer.parseInt(parts[8])-140;

}
else{

    // For GSM Signal Strength: dbm =  (2*ASU)-113.
    if (signalStrength.getGsmSignalStrength() != 99) {
                    int intdbm = -113 + 2
                            * signalStrength.getGsmSignalStrength();
                    dbm = Integer.toString(intdbm);
                }
}

bye

like image 200
Cocorico Avatar answered Oct 06 '22 06:10

Cocorico