从网页打开 android 应用程序 [英] Open android application from a web page
问题描述
我知道要从网页内的链接打开 android 应用程序,我们必须在 AndroidManifest.xml
中编写以下内容:
I know that for opening android application from a link inside a web page we have to write the following in the AndroidManifest.xml
:
<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="my_scheme" android:host="my_host" />
</intent-filter>
问题是我是这样写的:
<intent-filter>
<action android:name="my_action"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="my_scheme" android:host="my_host" />
</intent-filter>
我没有添加 android.intent.action.VIEW
而是添加了我自己的操作.我无法更改它,因为版本已经发布.
I didn't add android.intent.action.VIEW
and instead I added my own action that i made.
I can't change it because the version is already released.
问题是,
如果有一种方法可以让应用程序从 JavaScript 或简单地运行html 页面,也许通过在页面中定义特定的动作?
if there's a way to make the application run from JavaScript or simple html page, maybe by defining the specific action in the page?
谢谢,
帕兹.
已解决:
感谢大卫,我找到了一个解决方案:
Thanks to David I found a solution:
<a href="intent://my_host#Intent;scheme=my_scheme;action=my_action;end">Link to my stuff</a>
推荐答案
试试这个:
让你的链接看起来像这样:
Make your links look like this:
<a href="intent:#Intent;action=my_action;end">Link to my stuff</a>
另请参阅从安卓浏览器启动自定义安卓应用
这篇关于从网页打开 android 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!