Last active
February 18, 2020 02:59
-
-
Save stilllisisi/4c1785abffb5f639f1abf98b9ee862f4 to your computer and use it in GitHub Desktop.
【Android-地图/定位】唤起高德地图导航、唤起百度地图导航
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 唤起高德地图 | |
| */ | |
| private void startAmapMap() { | |
| try { | |
| Intent intent = new Intent("android.intent.action.VIEW", | |
| android.net.Uri.parse("androidamap://route?sourceApplication=导航demo" + | |
| "&dlat=" + mEndLat + | |
| "&dlon=" + mEndLng + | |
| "&dname=" + name + | |
| "&dev=0&t=2")); | |
| intent.setPackage("com.autonavi.minimap"); | |
| mActivity.startActivity(intent); | |
| } catch (Exception e) { | |
| T.showToast(mActivity, "调起高德地图失败"); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 移动APP调起Android百度地图方式 | |
| */ | |
| private void startBaiduMap() { | |
| try { | |
| Intent intent = new Intent(); | |
| intent.setData(Uri.parse("baidumap://map/direction?destination=name:" + name + "|" + | |
| "latlng:" + mEndLat + "," + mEndLng + "&mode=driving&car_type=TIME")); | |
| mActivity.startActivity(intent); // 启动调用 | |
| } catch (Exception e) { | |
| T.showToast(mActivity, "调起百度地图失败"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment