【发布时间】:2014-03-19 10:37:16
【问题描述】:
在我的应用程序中,如果在网络浏览器或其他字段中单击,我设置了一个意图过滤器以匹配某些类型的链接。目前看起来是这样的:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.mydomain.com"
android:scheme="http" />
<data
android:host="mydomain.com"
android:scheme="http" />
<data
android:host="m.mydomain.com"
android:scheme="http" />
</intent-filter>
这很好用。如果您单击链接说http://www.mydomain.com/article_name,那么用户可以选择在应用程序中打开文章,我可以唯一地显示内容。这是一个问题 - 在应用程序中,我想为用户提供一个选项,让他们仍然可以爆发并“在浏览器中打开”。但是,如果我这样做并只是尝试触发启动浏览器的意图,我的应用程序会再次捕获该链接,然后我们会绕一圈。
如何专门强制在浏览器中打开链接?
【问题讨论】: