我有一个返回LTE设备的小区id的方法,但在某些设备上它返回-1。下面是方法:
public int getCellId() {
int cellId = Integer.MAX_VALUE;
CellInfo cellInfo = null;
List<CellInfo> allCellInfo = telephonyManager.getAllCellInfo();
if(allCellInfo!= null && allCellInfo.size()>0)
cellInfo = allCellInfo.get(0);
if (cellInfo instanceof CellInfoLte) {
CellInfoLte cellInfoLte = (CellInfoLte) cellInfo;
if (cellInfoLte != null) {
cellId = cellInfoLte.getCellIdentity().getCi();
}
}
return cellId;
}发布于 2015-08-27 11:15:33
您已经正确地实现了它,不幸的是,并不是所有的制造商都正确地实现了所有的Android API,尤其是在电话领域。有时所有的LTE值也将为-1,有时仅为CI。
https://stackoverflow.com/questions/32204660
复制相似问题