目前几个主要的地图商都提供了自己的APP通过URL调用的形式。
百度地图
- 示例(iOS):
baidumap://map/direction?origin=中关村&destination=五道口&mode=driving®ion=北京
// 本示例是通过该URL启动地图app并进入北京市从中关村到五道口的驾车导航路线图
详细官方接口说明:https://lbsyun.baidu.com/index.php?title=uri/api/ios
- 示例(Android):
intent = Intent.getIntent("intent://map/line?coordtype=&zoom=®ion=上海&name=28&src=yourCompanyName|yourAppName#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end");
// 调起百度地图客户端(Android)展示上海市"28"路公交车的检索结果
详细官方接口说明:https://lbsyun.baidu.com/index.php?title=uri/api/android
高德地图
- 示例(iOS):
iosamap://navi?sourceApplication=applicationName&poiname=fangheng&poiid=BGVIS&lat=36.547901&lon=104.258354&dev=1&style=2
详细官方接口说明:https://developer.amap.com/api/amap-mobile/guide/ios/navi
- 示例(Android):
androidamap://navi?sourceApplication=appname&poiname=fangheng&lat=36.547901&lon=104.258354&dev=1&style=2 pkg=com.autonavi.minimap
详细官方接口说明:https://developer.amap.com/api/amap-mobile/guide/android/navigation
Apple Map
- 示例(iOS):
http://maps.apple.com/?daddr=San+Francisco,+CA&saddr=cupertino
详细官方接口说明:https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html
Google Map
- 示例(iOS):
comgooglemaps://?center=40.765819,-73.975866&zoom=14&views=traffic
详细官方接口说明:https://developers.google.com/maps/documentation/ios/urlscheme
- 示例(Android):
对于Android,是通过Intent形式打开Native Map.
Intent intent=new Intent(Intent.ACTION_VIEW);
String url = "https://maps.google.com/maps?q=31.207149,121.593086(金科路)&z=17&hl=en";
Uri uri = Uri.parse(url);
intent.setData(uri);
startActivity(intent);
详细官方Intent接口说明:http://developer.android.com/guide/components/intents-common.html#Maps
baidumap://map/direction?origin=中关村&destination=五道口&mode=driving®ion=北京
// 本示例是通过该URL启动地图app并进入北京市从中关村到五道口的驾车导航路线图
详细官方接口说明:https://lbsyun.baidu.com/index.php?title=uri/api/ios
intent = Intent.getIntent("intent://map/line?coordtype=&zoom=®ion=上海&name=28&src=yourCompanyName|yourAppName#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end");
// 调起百度地图客户端(Android)展示上海市"28"路公交车的检索结果
详细官方接口说明:https://lbsyun.baidu.com/index.php?title=uri/api/android
- 示例(iOS):
iosamap://navi?sourceApplication=applicationName&poiname=fangheng&poiid=BGVIS&lat=36.547901&lon=104.258354&dev=1&style=2
详细官方接口说明:https://developer.amap.com/api/amap-mobile/guide/ios/navi - 示例(Android):
androidamap://navi?sourceApplication=appname&poiname=fangheng&lat=36.547901&lon=104.258354&dev=1&style=2 pkg=com.autonavi.minimap
详细官方接口说明:https://developer.amap.com/api/amap-mobile/guide/android/navigation
Apple Map
- 示例(iOS):
http://maps.apple.com/?daddr=San+Francisco,+CA&saddr=cupertino
详细官方接口说明:https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html
Google Map
- 示例(iOS):
comgooglemaps://?center=40.765819,-73.975866&zoom=14&views=traffic
详细官方接口说明:https://developers.google.com/maps/documentation/ios/urlscheme
- 示例(Android):
对于Android,是通过Intent形式打开Native Map.
Intent intent=new Intent(Intent.ACTION_VIEW);
String url = "https://maps.google.com/maps?q=31.207149,121.593086(金科路)&z=17&hl=en";
Uri uri = Uri.parse(url);
intent.setData(uri);
startActivity(intent);
详细官方Intent接口说明:http://developer.android.com/guide/components/intents-common.html#Maps
http://maps.apple.com/?daddr=San+Francisco,+CA&saddr=cupertino
详细官方接口说明:https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html
- 示例(iOS):
comgooglemaps://?center=40.765819,-73.975866&zoom=14&views=traffic
详细官方接口说明:https://developers.google.com/maps/documentation/ios/urlscheme - 示例(Android):
对于Android,是通过Intent形式打开Native Map.
Intent intent=new Intent(Intent.ACTION_VIEW);
String url = "https://maps.google.com/maps?q=31.207149,121.593086(金科路)&z=17&hl=en";
Uri uri = Uri.parse(url);
intent.setData(uri);
startActivity(intent);
详细官方Intent接口说明:http://developer.android.com/guide/components/intents-common.html#Maps
2 条评论
2broear ( VIP 6 )
不错
站元素主机 ( VIP 1 )
赞一个 码住了