首页 > 学院 > 开发设计 > 正文

百度定位的核心代码块

2019-11-06 10:04:37
字体:
来源:转载
供稿:网友

使用百度定位:

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(); } } }); }
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表