你如何搭上打开一个网页的意图是什么? [英] How do you catch the intent for opening a web page?
问题描述
我想赶上当有人点击在MMS浏览器中的超链接到一个网页,被激发的意图。我有这样的清单:
I am trying to catch the intent that is fired when someone clicks on a hyperlink to a web page in the Mms browser. I have this in the manifest:
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
</intent-filter>
然而,当我点击 http://www.ibm.com 它只启动浏览器。同样的,当我做
$上午开始-a android.intent.action.VIEW -d http://www.ibm.com
在亚行的shell。任何想法我做错了吗?
However, when I click on http://www.ibm.com it only launches Browser. Same when I do $ am start -a android.intent.action.VIEW -d http://www.ibm.com in an adb shell. Any ideas what I am doing wrong?
非常感谢,
ç
Thanks very much, c
推荐答案
中intent-filter线从复制<一个href=\"http://android.git.kernel.org/?p=platform/packages/apps/Browser.git;a=blob;f=AndroidManifest.xml;h=3d970ab3984bb06057a6ca756cb59b7738581967;hb=HEAD\"相对=nofollow>浏览器的清单,它会工作:
Copy the intent-filter lines from the Browser's manifest and it will work:
<!-- For these schemes were not particular MIME type has been
supplied, we are a good candidate. -->
<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:scheme="http" />
<data android:scheme="https" />
<data android:scheme="about" />
<data android:scheme="javascript" />
</intent-filter>
<!-- For these schemes where any of these particular MIME types
have been supplied, we are a good candidate. -->
<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:scheme="http" />
<data android:scheme="https" />
<data android:scheme="inline" />
<data android:mimeType="text/html"/>
<data android:mimeType="text/plain"/>
<data android:mimeType="application/xhtml+xml"/>
<data android:mimeType="application/vnd.wap.xhtml+xml"/>
</intent-filter>
这篇关于你如何搭上打开一个网页的意图是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!