/**
* Returns a CellInfo object representing the currently registered base stations, containing
* its identity fields and signal strength. Null if no base station is active.
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@Nullable
private static CellInfo getActiveCellInfo(TelephonyManager telephonyManager) {
int numRegisteredCellInfo = 0;
List<CellInfo> cellInfos = telephonyManager.getAllCellInfo();
if (cellInfos == null) {
return null;
}
CellInfo result = null;
for (int i = 0; i < cellInfos.size(); i++) {
CellInfo cellInfo = cellInfos.get(i);
if (cellInfo.isRegistered()) {
numRegisteredCellInfo++;
if (numRegisteredCellInfo > 1) {
return null;
}
result = cellInfo;
}
}
// Only found one registered cellinfo, so we know which base station was used to measure
// network quality
return result;
}
PlatformNetworksManager.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:365browser
作者:
评论列表
文章目录