@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void startScan() {
logMessage("starting tower scan... ");
Scan scan = new Scan();
// TODO: Get location from user?
scan.setLocation(lastScanName);
// TODO: use actual GPS Coordinates
scan.setLatitude(lastScanLat);
scan.setLongitude(lastScanLon);
long scan_id = db.createScan(scan);
List<CellInfo> cellInfos = (List<CellInfo>) this.telephonyManager
.getAllCellInfo();
// TODO: better error handling of null cellinfos
if (cellInfos != null) {
for (CellInfo cellInfo : cellInfos) {
if (cellInfo instanceof CellInfoGsm) {
CellInfoGsm cellInfoGsm = (CellInfoGsm) cellInfo;
CellIdentityGsm cellIdentity = cellInfoGsm
.getCellIdentity();
CellSignalStrengthGsm cellSignalStrengthGsm = cellInfoGsm
.getCellSignalStrength();
int dbmLevel = cellSignalStrengthGsm.getDbm();
com.spideyapp.sqlite.model.CellInfo cell = new com.spideyapp.sqlite.model.CellInfo(
cellIdentity.getCid(), cellIdentity.getLac(),
cellIdentity.getMcc(), cellIdentity.getMnc(),dbmLevel);
db.createCell(cell, scan_id);
shareCellInfo (cell);
}
}
}
}
ScanService.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:spidey
作者:
评论列表
文章目录