gpt4 book ai didi

android - 谷歌导航 Intent

转载 作者:太空狗 更新时间:2023-10-29 14:20:39 26 4
gpt4 key购买 nike

我正在尝试直接从我的应用程序启动 Google Navigation,以便它将我从起始地址导航到目标地址。所以我有起始地址和目的地地址的纬度和经度坐标,并希望获得这些坐标的导航。但我不知道如何提供起始地址。导航仅使用我的 GPS 来获取我的当前信息。这就是我启动 Intent 的方式:

        String mLat = "46.849861";
String mLong ="-120.541992";
String dLat = "38.062419";
String dLong = "-99.173584";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" +dLat+","+dLong));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

最佳答案

你可以这样做

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
Uri.parse("http://maps.google.com/maps?saddr=20.344,34.34&daddr=20.5666,45.345"));
startActivity(intent);

关于android - 谷歌导航 Intent ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17280309/

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