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

2021-02-20  本文已影响0人  李先生1818

高德调起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"
                
                }
上一篇下一篇

猜你喜欢

热点阅读