ios and Android invoking third-party map navigation

 

 

<div the above mentioned id = " the Map " > 

            </ div> 
            <div class = " yb_choose_addr " > 
                <div class = " shop_info " > 
                    <H5> white car factory store (Zhengzhou, Luohe Road) </ H5> 
                    <the p-> <I class = " IconFont dingwei-icon " > </ I> Zhongyuan District Road Tongbai Road intersection Henan Province Luo </ P> 
                    <span> <I class = " IconFont dingwei-icon " > </ i> Hours:08:00-20:00</span>
                </div>
                <input type="button" name="" id="map_btn" value="确认" class="choose_btn" />
            </div>


mui.init();
        
        //选择门店  yb_choose_addr start 2019-10-18 王坚
        var _h = $(window).height();

        $("#map").css("height", _h - 60 + "px");

        var marker = null ;
         var Map = new new BMap.Map ( " Map " ); // Create a map instance   
        var Point = new new BMap.Point ( 113.665911 , 34.750593 ); // create point coordinate   
        map.centerAndZoom (Point, 15 ); 
        marker = new new BMap.Marker (Point); 
        the Map.addOverlay (marker); 

        $ ( " #map_btn " ) .on ( ' TAP ' , function () { 

            var shop_name =info.shop_name; 

            var Point = bd_decrypt ( 113.665911 , 34.750593 );
             IF (plus.os.name == " the Android " ) {
                 var BTS = [{ 
                    title: " Baidu map " 
                }, { 
                    title: " guide map " 
                } ]; 
            } the else  IF (plus.os.name == " the iOS " ) {
                 var BTS = [{ 
                    title: "Baidu map " 
                }, { 
                    title: " High German map " 
                }, { 
                    title: " map " 
                }]; 
            } 

            plus.nativeUI.actionSheet ({ 
                    title: " Select map " , 
                    the Cancel: " Cancel " , 
                    Buttons: BTS 
                }, 
                function (E) { 
                    IF (e.index == . 1 ) { 
                        openBMap (longitude, Latitude, shop_name); 
                    } the else  IF(e.index == 2) {
                        openAMap(point, shop_name);
                    } else if(e.index == 3) {
                        openMap(point, shop_name);
                    } else {
                        return false;
                    }
                }
            );
            return false;

        });

        function openMap(point, shop_name) {
            var url = "";
            switch(plus.os.name) {
                case "Android":
                    url = "geo:" + point.lat + "," + point.lng + "?q=" + shop_name;
                    break;
                case "iOS":
                    url = "http://maps.apple.com/?q=" + shop_name + "&ll=" + point.lat + "," + point.lng + "SPN = 0.008766,0.019441 & " BREAK ;
                 default :
                     return ;
                     BREAK ; 
            } 
            URL = the encodeURI (URL); 
            plus.runtime.openURL (URL, function (E) { 
                plus.nativeUI.alert ( " Check your program is not installed map \ n- " ); 
            }); 
        } 
        function openBMap (Jingdu, WeiDU, shop_name) { var URL = null , 
                ID = null , 
                F = null;
                    

            ;
             Switch (plus.os.name) {
                 Case  " Android " :
                     // specification refer to the official website: http://developer.baidu.com/map/index.php?title=uri/api/android 
                    url = " baidumap: the Map // / marker LOCATION =? " + WeiDU + " , " + Jingdu + " & title = " + shop_name + " & Content = & Wyatt car sinks " ; 
                    f = AndroidMarket; 
                    the above mentioned id = " com.baidu.BaiduMap";
                    break;
                 Case  " iOS " :
                     // specification refer to the official website: http://developer.baidu.com/map/index.php?title=uri/api/ios 
                    url = " baidumap: // the Map / marker LOCATION =? " WeiDU + + " , " + Jingdu + " & title = " + shop_name + " & car Yue Department Content = " ; 
                    F = iosAppstore; 
                    ID = " itunes.apple.com/cn/app/bai-du-de-tu-yu ? -yin-DAO-Hang / id452186370 MT = 8 " ;
                    BREAK ;
                 default :
                     return ;
                     BREAK ; 
            } 
            URL = the encodeURI (URL); 
            plus.runtime.openURL (URL, function (E) { 
                plus.nativeUI.confirm ( " Check your not installed \" Baidu map \ ", is to Search store downloaded? " , function (I) {
                     IF (i.index == 0 ) { 
                        F (ID); 
                    } 
                }); 
            }); 
        } 

        function openAMap (Point, shop_name) {
            var URL = null , 
                ID = null , 
                F = null ;
             Switch (plus.os.name) {
                 Case  " the Android " :
                     // specification refer to the official website: http://lbs.amap.com/api/uri-api/ EXPLAIN-uri-Android / 
                    url = " androidamap:? = // viewMap sourceApplication Yue car exchange poiname = & " + shop_name + " & LAT = " + point.lat + " & LON = " + point.lng + " &dev=0"  ;
                    F = AndroidMarket; 
                    the above mentioned id = " com.autonavi.minimap " ;
                     BREAK ;
                 Case  " iOS " :
                     // specification refer to the official website: http://lbs.amap.com/api/uri-api/ios-uri-explain / 
                    url = " iosamap:? = // viewMap sourceApplication Yue car exchange poiname = & " + shop_name + " & LAT = " + point.lat + " & LON = " + point.lng + " &dev=0";
                    F = iosAppstore; 
                    ID = " itunes.apple.com/cn/app/gao-tu-zhuan-ye-dao-hang-ban/id461703208?mt=8 " ;
                     BREAK ;
                 default :
                     return ;
                     BREAK ; 
            } 
            URL = the encodeURI (url); 
            plus.runtime.openURL (url, function (E) { 
                plus.nativeUI.confirm ( " check you do not have to install \" high moral map \ "? whether to store search download " , function (i) {
                     IF (i.index == 0) {
                        f(id);
                    }
                });
            }, id);
        }

 

 

 

 

Guess you like

Origin www.cnblogs.com/jiawenzhen/p/11881048.html