使用路线和检查点启动地图应用

时间:2014-01-25 15:27:18

标签: android google-maps android-intent

我想做的很简单。我想发布这样的意图。

        String url = "https://maps.google.com/maps?saddr=47.295601,0.010586&daddr=47.295601,1.010586+to:47.295601,2.010586+to:47.295601,3.01058";
        Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
                Uri.parse(url));

网址是这样的: https://maps.google.com/maps?saddr=47.295601,0.010586&daddr=47.295601,1.010586+to:47.295601,2.010586+to:47.295601,3.01058

意图推出很好,我可以选择"地图"和"浏览器" -apps。

当我选择使用"浏览器"打开此意图时,我可以毫无问题地查看带有它的检查点的路线。

但是,如果我选择使用Maps-app打开它。它会说"没有结果47.295,1.010到:47.295,2.010 .....等"

如何格式化网址,以便能够使用导航和检查点打开地图应用?

(即使您在浏览器中打开手机中的此链接,它也会询问您是否要打开地图应用。如果您这样做,也会出现同样的问题。)

谢谢你!

编辑: 我澄清一下:我想知道如何通过B,C,D,E等点从A点到Y点获取方向。

如何获得从A点到B点的指示;知道该怎么做。

1 个答案:

答案 0 :(得分:1)

以下内容对我有用。这是谷歌启动谷歌应用程序的指定方式。

Intent intent = new Intent(Intent.ACTION_VIEW, 
       Uri.parse("geo:47.295601,1.010586?q=my+street+address&z=20"));
startActivity(intent);

相同的链接在

之下

http://developer.android.com/guide/appendix/g-app-intents.html

以下帖子也提供了相同的

的大量信息

Launching Google Maps Directions via an intent on Android

Launching Google Maps and Navigator from Android App

希望这有帮助

相关问题