根据两个经纬度点调用百度地图应用查询路线 适用android或者ios中及网页浏览(手机网页同样适用)
来源:互联网 发布:工信部 大数据证书 编辑:程序博客网 时间:2024/05/01 09:47
Intent intent = null;try {// 如果有安装百度地图 就启动百度地图StringBuffer sbs = new StringBuffer();sbs.append("intent://map/direction?origin=latlng:")// 我的位置.append(latitude).append(",").append(longitude).append("|name:").append(getResources().getString(R.string.location))// 去的位置.append("&destination=latlng:").append(overlayItem.getPoint().getLatitudeE6() / 1E6) // 经度.append(",").append(overlayItem.getPoint().getLongitudeE6() / 1E6)// 纬度.append("|name:").append(overlayItem.getSnippet().replaceAll("nbsp;|&", ""))// 城市.append("&mode=driving®ion=").append(App.area_name).append("&referer=com.menu|menu#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end");try {intent = Intent.getIntent(sbs.toString());} catch (URISyntaxException e) {e.printStackTrace();}startActivity(intent);} catch (Exception e) {// 没有百度地图则弹出网页端StringBuffer sb = new StringBuffer();sb.append("http://api.map.baidu.com/direction?origin=latlng:")// 我的位置.append(latitude).append(",").append(longitude).append("|name:").append(getResources().getString(R.string.location))// 去的位置.append("&destination=latlng:").append(overlayItem.getPoint().getLatitudeE6() / 1E6).append(",").append(overlayItem.getPoint().getLongitudeE6() / 1E6).append("|name:").append(overlayItem.getSnippet().replaceAll("nbsp;|&", ""))// 城市.append("&mode=driving®ion=").append(App.area_name).append("&output=html");Uri uri = Uri.parse(sb.toString());intent = new Intent(Intent.ACTION_VIEW, uri);startActivity(intent);}
根据两个经纬度点调用百度地图应用查询路线 适用android或者ios中及网页浏览(手机网页同样适用)
检测是否安装百度地图 不过我这种捕获异常的方式检测百度地图是否安装不太好 来读取安装程序中是否有百度地图的方式比较正确 不过没必要 还是异常捕获吧
在应用中试了好多次才通过 写一个博客记录一下
ios怎么获取连接同上
3.7 公交、驾车、步行导航
3.7.1 服务地址
- 根据两个经纬度点调用百度地图应用查询路线 适用android或者ios中及网页浏览(手机网页同样适用)
- iOS-网页调用百度地图API
- 百度地图API之根据经纬度查询地址信息(Android)
- 百度地图API之根据经纬度查询地址信息(Android)
- 百度地图API之根据经纬度查询地址信息(Android)
- android 百度地图 四、(根据地名查询经纬度)
- 百度地图5之根据经纬度查询地址信息(Android) .
- 百度地图API之根据经纬度查询地址信息(Android)
- 百度地图API之根据经纬度查询地址信息(Android)
- 百度地图API之根据经纬度查询地址信息(Android)
- 百度地图API之根据经纬度查询地址信息(Android)
- 百度地图API之根据经纬度查询地址信息(Android)
- 百度地图应用:根据两个地址的经纬度求距离;根据地址求经纬度;根据经纬度求地址
- 根据经纬度,找到地址信息(调用android地图百度API)
- 在网页中通过百度地图查看某地的经纬度
- Android应用中打开百度地图、高德地图、网页版百度地图
- html5在网页中调用百度地图
- 网页中调用百度地图API
- stm32标准外设库使用详解
- android使用soap协议访问webservice实现天气预报功能
- linux 性能监控命令4——free
- UML用例图——更直观的需求分析
- SQL Server 2008登录错误:无法连接到(local)的解决
- 根据两个经纬度点调用百度地图应用查询路线 适用android或者ios中及网页浏览(手机网页同样适用)
- scanf使用常见问题及解决方法
- Windows Store apps开发[58]Windows 8 开发31日-第01日-一个空的应用程序
- time,ctime,gmtime,localtime
- 或许会带给你惊喜的几款软件
- UML图之行为图
- 时间与分配: 从一句话说开
- Unable to locate package build-essential
- DOM