我能够发布Google意图
Uri location = Uri.parse("geo:0,0");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, location);
startActivity(mapIntent);我如何在驱动模式下启动意图(没有目的地,除非事先在地图中设置),以便在下面的屏幕截图上看起来像?

我尝试设置mode=driving,但这只会打开常规地图,并选中“驱动”选项卡:
Uri location = Uri.parse("geo:0,0?mode=driving");发布于 2017-08-20 23:33:04
这将在驱动模式下启动谷歌地图
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);发布于 2017-06-06 15:10:45
我知道您想在导航模式下打开Google应用程序。为此,您可以使用Google API中描述的URL:
https://developers.google.com/maps/documentation/urls/guide#directions-action
下面的代码应该很有用,我相信您需要提供一个目标参数来直接打开这个模式。
String URL = "https://www.google.com/maps/dir/?api=1&travelmode=driving&dir_action=navigate&destination=Los+Angeles";
Uri location = Uri.parse(URL);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, location);
startActivity(mapIntent);我希望这能帮到你!
https://stackoverflow.com/questions/44249206
复制相似问题