我正在尝试在我的应用程序中获取lte小区id号:
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
List<CellInfo> cellInfoList = tm.getAllCellInfo();
for (CellInfo cellInfo : cellInfoList)
{
if (cellInfo instanceof CellInfoLte) {
CellIdentityLte cellIdentityLte = ((CellInfoLte) cellInfo).getCellIdentity();
cellID = cellIdentityLte.getCi();
}
}
但是 cellID = cellIdentityLte.getCi();
总是返回2147483647,最大值表示有问题。
我想访问位置和读取电话状态的权限就足够了。play store上的其他应用程序正在为我提供正确的手机ID,因此该设备不是问题所在(并在多部手机上进行了测试)。顺便说一下,正在运行sdkv.30。
1条答案
按热度按时间fzsnzjdm1#
在for循环中获取值时,也会迭代相邻单元,因为ue没有连接到它们,所以它们的cid为空。
下面是一个解决方案: