@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private static boolean isApi17CellInfoAvailable(Context context) {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
List<CellInfo> cells;
try {
cells = telephonyManager.getAllCellInfo();
} catch (SecurityException ex) {
Log.d("isApi17CellInfoAvailable(): Result = coarse location permission is denied", ex);
return false;
}
if (cells == null || cells.size() == 0) {
Log.d("isApi17CellInfoAvailable(): Result = no cell info");
return false;
}
CellIdentityValidator validator = new CellIdentityValidator();
for (CellInfo cell : cells) {
if (validator.isValid(cell)) {
Log.d("isApi17CellInfoAvailable(): Result = true");
return true;
}
}
Log.d("isApi17CellInfoAvailable(): Result = false");
return false;
}
MobileUtils.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:TowerCollector
作者:
评论列表
文章目录