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?
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