意图启动导航活动 [英] Intent to start a navigation activity

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

问题描述

在我的应用程序中,我可以选择开始导航到选定的 POI.基本上我想要的是从我的应用程序中启动一个转弯导航器.问题是我不知道安装了哪个(如果有的话)导航器.

In my application I have an option to start navigation to selected POI. Basically what I want is to launch a turn-by-turn navigator from my application. The thing is I don't know which (if any) navigator is installed.

那么,问题是如何通过首先向用户显示适合导航的活动列表来启动意图,让他选择他想使用的活动?也很高兴找到一种将额外参数传递给选定活动的方法(这对我来说听起来像是一个问题,因为不同的导航应用程序使用不同的名称来表示它们的额外参数,我猜).

So, the question is how to start an intent by showing a list of suitable activities for navigation to the user first, letting him choose which one he would like to use? Also would be nice to find a way to pass extra parameters to selected activity (this sounds like an issue to me, since different navigation apps use different names for their extras, I guess).

如果不清楚:我正在寻找一种方法来显示适合导航的应用程序列表,并选择将其设为默认值.

In case it's not clear: I'm looking for a way to DISPLAY A LIST OF SUITABLE APPLICATIONS FOR NAVIGATION WITH THE OPTION TO MAKE ONE DEFAULT.

在这里找到实现 http://datamoil.blogspot.com/2011/04/android-universal-intent-to-start.html

推荐答案

坏消息是,没有用于导航的标准 Intent URI.

The bad news is, there isn't a standard Intent URI for navigation.

是的,存在 google.navigation URI,应用可以选择支持它.

Yes, google.navigation URIs exist, and an app may choose to support it.

我能想到的最佳解决方案是:

The best solution I can think of is to:

  • 明确检查已知应用
  • 隐式检查挂钩 google.navigation: 和 也许 geo: 的应用程序:(但你也会获得地图应用程序)
  • Explicitly check for known apps
  • Implicitly check for apps hooking google.navigation: and perhaps geo: (but then you also get map apps)

您可以使用 PackageManage.queryIntentActivities

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

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