我可以从 HTML 调用我的应用程序吗?
例如:我可以从我的应用程序正确调用带有此代码的网页。
安卓代码:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(
"myDomain.com")));
在我的网站上做了一些事情之后,我想再次打开我的 Android 应用程序。
我找到这段代码,
<a href="market://details?id=info.androidhive.slidingmenu">
但它只是调用 Market 来查找和安装该应用程序!
最佳答案
你可以看看这个:https://developer.android.com/training/app-indexing/deep-linking.html
<activity
android:name="com.example.android.GizmosActivity"
android:label="@string/title_gizmos" >
<intent-filter android:label="@string/filter_title_viewgizmos">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
<data android:scheme="http"
android:host="www.example.com"
android:pathPrefix="/gizmos" />
<!-- note that the leading "/" is required for pathPrefix-->
<!-- Accepts URIs that begin with "example://gizmos”
<data android:scheme="example"
android:host="gizmos" />
-->
</intent-filter>
因此您的应用将通过此链接启动:
<a href="example://gizmos">
关于javascript - 如何从网页打开android应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31404341/