意图过滤来自Google+的作品,而不是Chrome浏览器和Facebook的 [英] Intent filter works from Google+, but not Chrome & Facebook
问题描述
我在的我在谷歌Play应用程式:
<activity
android:name="com.enigmadream.picturecode.Viewer"
android:exported="true"
android:label="@string/title_activity_viewer"
android:parentActivityName="com.enigmadream.picturecode.Editor" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.enigmadream.picturecode.Editor" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="picturecode.enigmadream.com"
android:scheme="http" />
</intent-filter>
</activity>
和我还以为是工作得很好。它似乎仍然如果你点击来自Google+ 一个链路上工作得很好 - 它提供了选项以启动我的应用程序,而不是浏览器中,当您单击使用服务器名称图片code.enigmadream.com
中的链接。但是,当我一个点击链接到图片code。 enigmadream.com从在Facebook或Chrome,它不提供的选项,而不只是导航到该页面在Chrome中。我缺少什么?
And I thought it was working just fine. It still seems to work just fine if you click on a link from Google+ - it offers the option to launch my app instead of the browser when you click on a link that uses the server name picturecode.enigmadream.com
. But when I click on a link to picturecode.enigmadream.com from within Facebook or Chrome, it doesn't offer the option, and instead just navigates to the page in Chrome. What am I missing?
推荐答案
您需要使用您自己的方案(如图片code://)。 Facebook和Chrome浏览器既可以或许对付自己的HTTP方案,因此不检查,看是否有其他活动,都能应付自如。这样做的结果是,你可能不需要有代替主机一方在较短的URI。刚图片code:// 01sv ...
。你当然也可以保持这个过滤器的地方为好。如果浏览器到达的页面,只是有去正确的URI的链接,或者如果可能的话甚至只是自动重定向。
You need to use your own scheme (eg. picturecode://). Facebook and Chrome can both probably deal with the http scheme on their own and so don't check to see if any other activities can handle it. The upshot of this is that you may not need to have the host in place either, for a shorter URI. Just picturecode://01sv...
. You can of course also keep this filter in place as well. If a browser gets to the page, just have a link that goes to the correct URI, or even just automatically redirect if possible.
有关参考,你可以看到谷歌使用市场发挥工作是这样的://方案
For reference, you can see Google Play work this way using the market:// scheme.
这篇关于意图过滤来自Google+的作品,而不是Chrome浏览器和Facebook的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!