gpt4 book ai didi

java - 从自定义应用程序启动百度 map Intent

转载 作者:行者123 更新时间:2023-11-30 10:34:24 25 4
gpt4 key购买 nike

在我的应用程序中,我获得了一个送货地址。当用户按下一个按钮时,它会启动一个以该地址作为参数的谷歌地图 Intent 。

String uri = String.format(Locale.ENGLISH, "google.navigation:q=" + shipmentAdress);
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(uri));
startActivity(intent);

我想为无法访问 Google map 但可以访问百度 map 的中国客户做同样的事情。请记住,我没有 GPS 坐标,只有地址。

有人知道我会怎么做吗?他们所有的文档都是中文的,他们的应用程序也是中文的,而我对谷歌翻译的了解也仅限于此。

我已经把它归结为类似 "baidumap://map/geocoder?src=openApiDemo&address=" 但它通常会返回错误(我想,我使用了错误的屏幕截图和Pleco 的 OCR 来翻译它。)

最佳答案

最终想通了:

String uri = String.format(Locale.CHINA, "baidumap://map/navi?query=" + shipmentAdress);
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(uri));
startActivity(intent);

关于java - 从自定义应用程序启动百度 map Intent ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41676485/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com