Android-如何在行驶模式下启动Google Map Intent? [英] Android - How to launch Google map intent in driving mode?

查看:161
本文介绍了Android-如何在行驶模式下启动Google Map Intent?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够通过以下方式启动Google Maps意向

I am able to launch Google Maps intent with

Uri location = Uri.parse("geo:0,0");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, location);
startActivity(mapIntent);

如何在驱动模式下启动意图(无目的地,除非先前在地图"中设置了),以使它看起来像下面的屏幕截图?

How can I launch the intent in Driving mode (with no destination, unless previously set in Maps) so that it looks like on the screenshot below?

我尝试设置mode=driving,但是只是在选择驾驶"标签的情况下打开了常规地图:

I tried setting mode=driving but that just opens the regular map with the "driving" tab selected:

 Uri location = Uri.parse("geo:0,0?mode=driving");

推荐答案

这将在驾驶模式"下启动Google地图

This will launch google maps in Driving Mode

    Intent intent = getPackageManager().getLaunchIntentForPackage("com.google.android.apps.maps");
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("google.navigation:/?free=1&mode=d&entry=fnls"));
    startActivity(intent);

这篇关于Android-如何在行驶模式下启动Google Map Intent?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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