Paz*_*Paz 18 html javascript android action android-intent
我知道要从网页内的链接打开android应用程序,我们必须在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>
Run Code Online (Sandbox Code Playgroud)
问题是我用以下方式编写它:
<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>
Run Code Online (Sandbox Code Playgroud)
我没有添加"android.intent.action.VIEW",而是添加了我自己的动作.我无法更改它,因为该版本已经发布.
问题是,如果有办法让应用程序从JavaScript或简单的html页面运行,可能是通过定义页面中的特定操作?
谢谢,
拉巴斯.
解决了:
感谢大卫我找到了一个解决方案:
<a href="intent://my_host#Intent;scheme=my_scheme;action=my_action;end">Link to my stuff</a>
Run Code Online (Sandbox Code Playgroud)
Dav*_*ser 22
试试这个:
使您的链接看起来像这样:
<a href="intent:#Intent;action=my_action;end">Link to my stuff</a>
Run Code Online (Sandbox Code Playgroud)
另请参阅从Android浏览器启动自定义Android应用程序
小智 6
AndroidMainfest 声明:
<activity android: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="hostName"
android:path="path"
android:scheme="schemeName" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
你可以让调用
<a href = "schemeName://hostName/path">
Run Code Online (Sandbox Code Playgroud)
或者在浏览器中添加参数类似的url
<a href = "schemeName://hostName/path?id=1&name=mark">
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
50279 次 |
| 最近记录: |