如何在Android Studio(TelephonyManager)上获取LTE的eNB id

JBS*_*ili 2 lte

再会,

请问如何获取CellIdentityLte的eNB id?

有什么办法可以得到吗?

谢谢!

JBS*_*ili 5

我得到了它!

                    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));
Run Code Online (Sandbox Code Playgroud)

通过使用这种方法...

// Decimal -> hexadecimal
public String DecToHex(int dec){
    return String.format("%x", dec);
}

// hex -> decimal
public int HexToDec(String hex){
    return Integer.parseInt(hex, 16);
}
Run Code Online (Sandbox Code Playgroud)