从网页(包括app中webview)打开APP

来源:互联网 发布:程序员投资 编辑:程序博客网 时间:2024/04/29 10:52

只需要在需要打开的activity标签下添加intent-filter

<intent-filter>      <action android:name="android.intent.action.VIEW" />       <category android:name="android.intent.category.BROWSABLE" />       <category android:name="android.intent.category.DEFAULT" />       <!-- scheme是必须的,其他的不必须 -->       <data            android:scheme="xiaohouzi"            android:host="hou"            android:sspPrefix="/123"            android:port=""          /></intent-filter>

html页面中需要超链接地址

<a href="xiaohouzi://hou/123">点击打开应用</a>

这样点击打开应用时就会跳到注册了的activity

0 0