public static GSMInfo getGSMInfo(Context context) {
try {
GSMInfo info = new GSMInfo();
TelephonyManager manager = (TelephonyManager) context.getSystemService("phone");
if (manager != null) {
CellLocation cellLocation = manager.getCellLocation();
int lac = 0;
int cellid = 0;
if (cellLocation != null) {
if (cellLocation instanceof GsmCellLocation) {
lac = ((GsmCellLocation) cellLocation).getLac();
cellid = ((GsmCellLocation) cellLocation).getCid();
} else if (cellLocation instanceof CdmaCellLocation) {
cellid = ((CdmaCellLocation) cellLocation).getNetworkId();
lac = ((CdmaCellLocation) cellLocation).getBaseStationId();
}
}
info.lac = lac;
info.cid = cellid;
}
AMapLocation location = AMapLocationTool.getInstance().location();
if (location != null) {
info.latitude = location.getLatitude();
info.longitude = location.getLongitude();
return info;
}
info.latitude = Double.parseDouble(PreferencesManager.getInstance().getLocationLongitude());
info.longitude = Double.parseDouble(PreferencesManager.getInstance().getLocationLatitude());
return info;
} catch (Exception e) {
LogInfo.log("ZSM++ ==== GSM exception e == " + e.getMessage());
e.printStackTrace();
return null;
}
}
LetvUtils.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:letv
作者:
评论列表
文章目录