【发布时间】:2018-04-29 18:05:26
【问题描述】:
我在找到答案后创建了这个问题,我不确定礼仪,但它seems to be OK(另外,我看到现在有一个内置选项)。
问题如标题所述,我们使用类似于以下的代码创建了一个意图选择器:
String url = "waze://?ll=" + latitude + ", " + longitude + "&navigate=yes";
Intent intentWaze = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
String uriGoogle = "google.navigation:q=" + latitude + "," + longitude;
Intent intentGoogleNav = new Intent(Intent.ACTION_VIEW, Uri.parse(uriGoogle));
String title = context.getString(R.string.title);
Intent chooserIntent = Intent.createChooser(intentGoogleNav, title);
Intent[] arr = new Intent[1];
arr[0] = intentWaze;
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, arr);
context.startActivity(chooserIntent);
还有两个位智图标和一个谷歌地图图标;更糟糕的是,其中一个位智图标没有启动导航(仅打开应用程序)。
我们不能use the geo:intent,因为我们需要控制显示的intent(我们不想一直显示这两种intent)和谷歌地图中的导航类型(例如:&mode=w)。
【问题讨论】:
标签: android google-maps android-intent-chooser waze