相邻单元格信息始终在大多数设备中返回空值。此外,我发现一篇文章建议使用getCellAllInfo,但仅支持API 17及更高版本。请建议我解决方案,以获得至少3的蜂窝塔信息。
以下是我的代码:
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
GsmCellLocation cellLocation = (GsmCellLocation) telephonyManager
.getCellLocation();
String networkOperator = telephonyManager.getNetworkOperator();
String mcc = networkOperator.substring(0, 3);
String mnc = networkOperator.substring(3);
int cid = cellLocation.getCid();
int lac = cellLocation.getLac();
int psc = cellLocation.getPsc();
List<NeighboringCellInfo> NeighboringList = telephonyManager
.getNeighboringCellInfo();
int = NeighboringList.size()