如何从网页打开android应用程序?

use*_*863 5 html javascript android ios web

我可以从 HTML 调用我的应用程序吗?

例如:我可以从我的应用程序中正确调用带有此代码的网页。

安卓代码:

  startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(
                                    "myDomain.com")));
Run Code Online (Sandbox Code Playgroud)

在我的网站上做了一些事情之后,我想再次打开我的 android 应用程序。

我找到了这个代码,

<a href="market://details?id=info.androidhive.slidingmenu">
Run Code Online (Sandbox Code Playgroud)

但它只是调用 Market 来查找和安装该应用程序!

Ric*_*kyy 8

你可能看看这个: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>
Run Code Online (Sandbox Code Playgroud)

因此,您的应用程序将通过此链接启动:

<a href="example://gizmos">
Run Code Online (Sandbox Code Playgroud)