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

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

问题描述

在我的应用程序有一个选项,开始导航至选定的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.

编辑:在这里可以找到执行<一个href="http://datamoil.blogspot.com/2011/04/android-universal-intent-to-start.html">http://datamoil.blogspot.com/2011/04/android-universal-intent-to-start.html

Find here the implementation http://datamoil.blogspot.com/2011/04/android-universal-intent-to-start.html

推荐答案

坏消息是,没有一个标准的意图的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)

您可以通过枚举可能隐含的目标<一href="http://developer.android.com/reference/android/content/pm/PackageManager.html#queryIntentActivities%28android.content.Intent,%20int%29">PackageManage.queryIntentActivities

You can enumerate the possible implicit targets using PackageManage.queryIntentActivities

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

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