/** * 保存经纬度 * * @return */ private void keepLocation(String latitude, String longitude) { BufferedWriter locationWriteer = null; File locationFile = null; try { File dir = new File(FileUtils.getMemoryDirPath() + File.separator + FileUtils.ATTACHMANEPATH); if (!dir.exists()) { dir.mkdirs(); } locationFile = new File(dir, "location.txt"); locationWriteer = new BufferedWriter(new BufferedWriter(new FileWriter(locationFile, true))); StringBuilder locationInfo = new StringBuilder(); locationInfo.append(latitude); locationInfo.append(","); locationInfo.append(longitude); locationInfo.append(","); locationInfo.append(DateUtils.getCurrentDateTimeStr()); locationWriteer.write(locationInfo.toString()); locationWriteer.newLine(); } catch (Exception e) { Logger.error(Logger.LOG_SYSTEM_ERROR, e, "收集经纬度信息出错"); if (null != locationFile) locationFile.delete(); } finally { try { locationWriteer.close(); } catch (Exception e) { e.printStackTrace(); } } }