【发布时间】:2014-05-22 19:12:59
【问题描述】:
如果 html 页面在安卓手机浏览器中打开,我只需要在单击 html 页面按钮时打开应用程序。
对不起我的英语。
请建议。
提前致谢
【问题讨论】:
标签: android
如果 html 页面在安卓手机浏览器中打开,我只需要在单击 html 页面按钮时打开应用程序。
对不起我的英语。
请建议。
提前致谢
【问题讨论】:
标签: android
您可以将应用程序的Main-activity 的intent-filter 设置如下,以从浏览器打开此应用程序。
<activity
android:name="activity_name">
<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="example.com"
android:scheme="http" />
<data
android:host="www.example.com"
android:scheme="http" />
</intent-filter>
</activity>
编辑:
如果你已经写了<intent-filter> 上面提到的你的活动,那么你可以在 html 按钮上打开你的应用程序,如下所示。
点击 html 页面按钮调用 url http://www.example.com
示例:
<input type=button onClick="parent.location='http://www.example.com'" value='Open App'>
【讨论】:
可以从深层链接启动已安装的应用程序。
【讨论】: