谷歌导航意图 [英] Google Navigation intent

查看:327
本文介绍了谷歌导航意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想直接从我的应用程序启动谷歌导航等,这将导航我从一个起始地址到达目的地址。所以我的纬度和经度坐标为起点和目的地址,并想获得导航这些。但我无法弄清楚如何提供一个起始地址。导航只用我的GPS获得我的当前信息。这是我发起的意图:

 字符串MLAT =46.849861;
        串mLong = -  120.541992;
        字符串DLAT =38.062419;
        字符串dLong =-99.173584;
        意向意图=新的意图(Intent.ACTION_VIEW,Uri.parse(google.navigation:Q =+ DLAT +,+ dLong));
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(意向);
 

解决方案

您可以做这样

 意向意图=新的意图(android.content.Intent.ACTION_VIEW,
    Uri.parse(http://maps.google.com/maps?saddr=20.344,34.34&daddr=20.5666,45.345));
startActivity(意向);
 

I'm trying to launch Google Navigation directly from my application such that it would navigate me from a start address to a destination address. So I have the Latitude and Longitude coordinates for both start and destination address and would like to get the navigation for those. But I can't figure out how to provide a start address. Navigation only uses my GPS to obtain my current info. This is how I launch the 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);

解决方案

You can do it this way

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);

这篇关于谷歌导航意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆