惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
S
Securelist
MyScale Blog
MyScale Blog
Jina AI
Jina AI
罗磊的独立博客
The Cloudflare Blog
美团技术团队
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
月光博客
月光博客
雷峰网
雷峰网
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
博客园 - Franky
博客园 - 聂微东
Y
Y Combinator Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
T
Tailwind CSS Blog
Attack and Defense Labs
Attack and Defense Labs
博客园_首页
Latest news
Latest news
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Hacker News
The Hacker News
G
GRAHAM CLULEY
Simon Willison's Weblog
Simon Willison's Weblog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
U
Unit 42
D
Docker
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
T
Tor Project blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
B
Blog
Recent Announcements
Recent Announcements
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Security Latest
Security Latest
V2EX - 技术
V2EX - 技术
N
News | PayPal Newsroom
Microsoft Security Blog
Microsoft Security Blog

博客园 - 莫小龙

uniapp之plus.downloader.createDownload下载文件传参 谷歌之将网页保存为图片 elementui之table中相同数据的单元格合并 krpano之使用教程 threejs之灯光不跟随OrbitControls控制器旋转 threejs之将张纹理图片组成材质组 canvas之修改Base64图片中不透明部分的颜色 threejs之将PlaneGeometry转换为BufferGeometry threejs之利用shape通过线绘制面和体 threejs之添加渐变背景 threejs之创建发光墙体 paperjs之fitBounds适应区域前后屏幕坐标和输入坐标的转换 arcmap之通过点数据获取等值线 openlayer之添加带箭头的线 geoserver之图片图标样式 SHP转WKT文件工具 openlayers之geoserver的wms图层mysql数据源数据修改后更新问题 通过日照时数计算每天RAD(太阳辐射)值 Uniapp之安卓签名证书(.keystore)生成
uniapp之安卓APP打开百度地图、高德地图APP
莫小龙 · 2025-05-08 · via 博客园 - 莫小龙

uniapp之安卓APP打开百度地图、高德地图APP

方法:

            openNavigation(longitude, latitude, i, name) {
                let url = ""; // app url
                // 判断用户选择的地图
                switch (i) {
                    // 下面是拼接url,不同系统以及不同地图都有不同的拼接字段
                    case 1: // 打开高德地图
                        url =
                            `androidamap://viewMap?sourceApplication=appname&poiname=${name}&lat=${latitude}&lon=${longitude}&dev=0`;
                        break;
                    case 2: // 打开百度地图
                        url =
                            `baidumap://map/marker?location=${latitude},${longitude}&title=${name}&coord_type=gcj02&src=andr.baidu.openAPIdemo`;
                        break;
                }
                // 如果选中
                if (url != "") {
                    url = encodeURI(url);
                    // 打开 app 导航 
                    plus.runtime.openURL(url, (err) => {
                        // 失败回到
                        // 毕竟用户可能没有安装app但一定安装的有浏览器
                        // 如果失败则说明未安装 直接 打开网页版进行导航
                        let chooseMap = ''
                        if (i == 1) {
                            chooseMap = "高德地图"
                        } else if (i == 2) {
                            chooseMap = "百度地图"
                        }
                        uni.showModal({
                            title: '提示',
                            content: '检测到您本机暂未安装' + chooseMap + '应用,请先安装APP。',
                            showCancel: false,
                            success: function(res) {
                                console.log('成功')
                            }
                        });
                    });
                }
            },

调用:

this.openNavigation(this.endPointLonlat[0], this.endPointLonlat[1], 1, '')

。。。。。。钻研不易,转载请注明出处。