使用百度定位:
PRivate void locateRunman() { AppContext.getInstance().startLocation(null, new BaiMapLocationCallBack() { @Override public void onLocationReceived(BDLocation location, LocationClient client) { if (location == null) { return; } double longitude = location.getLongitude(); double latitude = location.getLatitude(); DecimalFormat decimalFormat = new DecimalFormat( "#,##0.000000"); String city = StringUtils.trimNull(location.getCity()); String address = StringUtils.trimNull(location .getAddrStr()); RunmanLocationBean locBean = new RunmanLocationBean(); locBean.setAddress(address); locBean.setCreatetime(DateUtils.getNowTimeStamp()); locBean.setLatitude(decimalFormat.format(latitude)); locBean.setLongitude(decimalFormat.format(longitude)); locBean.setCity(city); if (runman != null) { locBean.setRunmanId(runman.getRunManId()); } MyLog.d(getLogTag(), locBean.toString()); if (needQueryWeatherInfo(city)) { // 查询天气 queryWeather(); } else { initWeatherInfo(); } } }); }新闻热点
疑难解答