如何在Android Studio(TelephonyManager)上获取LTE的eNB id
你好 请问如何获取CellIdentityLte的eNB id 有什么办法得到它吗 谢谢 我明白了如何在Android Studio(TelephonyManager)上获取LTE的eNB id,lte,Lte,你好 请问如何获取CellIdentityLte的eNB id 有什么办法得到它吗 谢谢 我明白了 final CellIdentityLte identityLte = ((CellInfoLte) info).getCellIdentity(); int longCid = identityLte.getCi(); String cellidHex = DecToHex(
final CellIdentityLte identityLte = ((CellInfoLte) info).getCellIdentity();
int longCid = identityLte.getCi();
String cellidHex = DecToHex(longCid);
String eNBHex = cellidHex.substring(0, cellidHex.length()-2);
int eNB = HexToDec(eNBHex);
return checkValidString(Integer.toString(eNB));
通过使用这种方法
// Decimal -> hexadecimal
public String DecToHex(int dec){
return String.format("%x", dec);
}
// hex -> decimal
public int HexToDec(String hex){
return Integer.parseInt(hex, 16);
}
只需使用:
identityLte.getCi() >> 8
这正是我要找的。我测试过了,这是真的。getCi()I的输出转换为十六进制,最后两个符号是本地单元格ID的十六进制值,其余是eNodeB ID的十六进制值。例如,转换为十六进制的1046022是FF606。eNodeB为FF6->4086,本地小区ID为06->6。与我所连接的LTE小区的配置完全相同。