【问题标题】:Is it possible to launch android app with a click of button on a website [duplicate]是否可以通过单击网站上的按钮来启动 android 应用程序 [重复]
【发布时间】:2019-07-09 16:13:06
【问题描述】:

我正在构建一个供自己使用的网站,并且想知道是否可以通过在手机上的浏览器中打开网站上的按钮来启动特定的 Android 应用程序。

【问题讨论】:

  • 这涉及修改应用程序的代码。我想启动任何不属于我且没有源代码的应用程序。

标签: javascript android


【解决方案1】:

除非您知道应用程序的方案,否则您无法打开任何应用程序。

要了解有关深层链接的更多信息,请查看此内容。 https://developer.android.com/training/app-links/deep-linking

这是来自 Android 文档。


它的工作方式非常简单。在Android应用中你需要申请...

<activity
    android:name="com.example.android.GizmosActivity"
    android:label="@string/title_gizmos" >
    <intent-filter android:label="@string/filter_view_http_gizmos">
        <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-->
    </intent-filter>
    <intent-filter android:label="@string/filter_view_example_gizmos">
        <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 "example://gizmos” -->
        <data android:scheme="example"
              android:host="gizmos" />
    </intent-filter>
</activity>

例如,上面的代码将查找http 以及example 的方案

所以链接可以是http://www.gizmos.comexample://gizmos。但是由于您要打开任何应用程序,除非您知道他们的方案和路径,否则这是不可能的......这不太可能。

【讨论】:

    猜你喜欢
    • 2017-07-10
    • 2018-11-22
    • 2022-01-03
    • 2013-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-24
    • 1970-01-01
    相关资源
    最近更新 更多