关于导航的使用(感恩我的领导阿密,没有收版权费)
2016-01-13 14:32
162 查看
if (AppUtils.checkPackage(getApplicationContext(),
"com.autonavi.minimap")) {
// 移动APP调起Android高德地图方式
Intent intent = new Intent(
"android.intent.action.VIEW",
android.net.Uri
.parse("androidamap://navi?sourceApplication=appname&poiname="
+ toLatLng.getLanName()
+ "&lat="
+ toLatLng.getLatitude()
+ "&lon="
+ toLatLng.getLongitude()
+ "&dev=0&style=2"));
intent.setPackage("com.autonavi.minimap");
context.startActivity(intent);
} else if (AppUtils.checkPackage(getApplicationContext(),
"com.baidu.BaiduMap")) {
// 移动APP调起Android百度地图方式
Intent intent = null;
try {
intent = Intent
.getIntent("intent://map/direction?origin=latlng:"
+ fromLatLng.getLatitude()
+ ","
+ fromLatLng.getLongitude()
+ "|name:"
+ fromLatLng.getLanName()
+ "&destination=latlng:"
+ toLatLng.getLatitude()
+ ","
+ toLatLng.getLongitude()
+ "|name:"
+ toLatLng.getLanName()
+ "&mode=driving&coord_type=gcj02&src=依威能源|E充站#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end");
context.startActivity(intent); // 启动调用
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
// 移动APP调起高德网页地图方式
String urlStr = "http://m.amap.com/?from="
+ fromLatLng.getLatitude() + ","
+ fromLatLng.getLongitude() + "(from)&to="
+ toLatLng.getLatitude() + "," + toLatLng.getLongitude()
+ "(to)&type=0&opt=0&dev=0";
Uri uri = Uri.parse(urlStr);
Intent it = new Intent(Intent.ACTION_VIEW, uri);
context.startActivity(it);
// T.showLong(getActivity(), "检测到你还没有安装地图");
}
"com.autonavi.minimap")) {
// 移动APP调起Android高德地图方式
Intent intent = new Intent(
"android.intent.action.VIEW",
android.net.Uri
.parse("androidamap://navi?sourceApplication=appname&poiname="
+ toLatLng.getLanName()
+ "&lat="
+ toLatLng.getLatitude()
+ "&lon="
+ toLatLng.getLongitude()
+ "&dev=0&style=2"));
intent.setPackage("com.autonavi.minimap");
context.startActivity(intent);
} else if (AppUtils.checkPackage(getApplicationContext(),
"com.baidu.BaiduMap")) {
// 移动APP调起Android百度地图方式
Intent intent = null;
try {
intent = Intent
.getIntent("intent://map/direction?origin=latlng:"
+ fromLatLng.getLatitude()
+ ","
+ fromLatLng.getLongitude()
+ "|name:"
+ fromLatLng.getLanName()
+ "&destination=latlng:"
+ toLatLng.getLatitude()
+ ","
+ toLatLng.getLongitude()
+ "|name:"
+ toLatLng.getLanName()
+ "&mode=driving&coord_type=gcj02&src=依威能源|E充站#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end");
context.startActivity(intent); // 启动调用
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
// 移动APP调起高德网页地图方式
String urlStr = "http://m.amap.com/?from="
+ fromLatLng.getLatitude() + ","
+ fromLatLng.getLongitude() + "(from)&to="
+ toLatLng.getLatitude() + "," + toLatLng.getLongitude()
+ "(to)&type=0&opt=0&dev=0";
Uri uri = Uri.parse(urlStr);
Intent it = new Intent(Intent.ACTION_VIEW, uri);
context.startActivity(it);
// T.showLong(getActivity(), "检测到你还没有安装地图");
}
相关文章推荐
- “约定优于配置”与Magento改造尝试四之block、helper和model加载
- Android--MVP模式--简介
- jquery验证(产品三期-院历增加)
- 商标查询api 模糊查询商标列表
- 简单排序算法 冒泡排序 选择排序 插入排序
- java获取时间戳的方法
- 数据碎片解析
- elasticsearch高级配置之分片分布规则设置
- 查看Oracle表空间大小
- baselineAligned
- JDK1.7 Paths,Files类实现文件夹的复制与删除
- 201,.plist文件 与 .pch文件的了解
- 测试手机视频录屏并转GIF功能
- iOS:扩展UIColor,支持十六进制颜色设置
- BZOJ1832 [AHOI2008] 聚会
- Block--两个界面 间回调传值
- workerman运行分析--主进程流程
- 动手制作自己的Docker镜像
- java newFixedThreadPool 报错
- 一些代码优化的方法