我试图在Android工作室中获取连接到手机的手机信号塔的信息。 这是我的代码:
telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
List<CellInfo> cellInfos = telephonyManager.getAllCellInfo();
for (CellInfo cellInfo:cellInfos){
if (cellInfo instanceof CellInfoGsm){
textViewCellular.append("\n\nType: GSM");
textViewCellular.append("\nCell Identity:\n\tCID:" + ((CellInfoGsm) cellInfo).getCellIdentity().getCid());
textViewCellular.append("\n\tLAC:" + ((CellInfoGsm) cellInfo).getCellIdentity().getLac());
textViewCellular.append("\n\tMCC:" + ((CellInfoGsm) cellInfo).getCellIdentity().getMcc());
textViewCellular.append("\n\tMNC:" + ((CellInfoGsm) cellInfo).getCellIdentity().getMnc());
textViewCellular.append("\nSignal Strength:" + ((CellInfoGsm) cellInfo).getCellSignalStrength().getDbm() + "dBm");
}
}
但是,在我的手机上运行代码会给我相同的价值:CID = LAC = MCC = MNC = Signal strength = 2147483647
对此有任何解释吗?