美文网首页
2021-02-20移动端调起高德地图app和高德网页

2021-02-20移动端调起高德地图app和高德网页

作者: 李先生1818 | 来源:发表于2021-02-20 08:54 被阅读0次

高德调起app传送门:http://lbs.amap.com/api/amap-mobile/summary/
       百度调起app传送门:http://lbsyun.baidu.com/index.php?title=uri/api/android
       百度网页版传送门:http://lbsyun.baidu.com/index.php?title=uri/api/web
       Github:https://github.com/MZCretin/ExternalMapUtils

function gotoMapApp() {
  var u = navigator.userAgent;
  var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1;
  var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  if (isAndroid) {
    location.href =
      "androidamap://navi?sourceApplication=amap&poiname=发生地址&lon=" +
      location1[0] +
      "&lat=" +
      location1[1] +
      "&dev=0&style=2";
  }
  if (isIOS) {
    location.href =
      "iosamap://navi?sourceApplication=amap&poiname=发生地址&lon=" +
      location1[0] +
      "&lat=" +
      location1[1] +
      "&dev=0&style=2";
  }
}
//跳转手机地图app进行导航
function gotoMapApp() {
  // toast("此功能正在开发中....");
   location.href =
     "[图片上传失败...(image-7e00c5-1613782429573)]

http://uri.amap.com/navigation?to=" +
     location1[0] +
     "," +
     location1[1] +
     ",发生地址&src=krrj&coordinate=gaode&callnative=1";
}

if (isAndroid) {
                    
                    location.href = "bdapp://map/navi?location=22.641521,114.1342132&src=andr.baidu.openAPIdemo"
                    
                }
                if (isIOS) {
                    
                    location.href = "baidumap://map/navi?location=22.641521,114.134213&coord_type=bd09ll&type=BLK&src=ios.baidu.openAPIdemo"
                
                }

相关文章

网友评论

      本文标题:2021-02-20移动端调起高德地图app和高德网页

      本文链接:https://www.haomeiwen.com/subject/lnhtfltx.html