【发布时间】:2019-07-09 16:13:06
【问题描述】:
我正在构建一个供自己使用的网站,并且想知道是否可以通过在手机上的浏览器中打开网站上的按钮来启动特定的 Android 应用程序。
【问题讨论】:
-
这涉及修改应用程序的代码。我想启动任何不属于我且没有源代码的应用程序。
标签: javascript android
我正在构建一个供自己使用的网站,并且想知道是否可以通过在手机上的浏览器中打开网站上的按钮来启动特定的 Android 应用程序。
【问题讨论】:
标签: javascript android
除非您知道应用程序的方案,否则您无法打开任何应用程序。
要了解有关深层链接的更多信息,请查看此内容。 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.com 或example://gizmos。但是由于您要打开任何应用程序,除非您知道他们的方案和路径,否则这是不可能的......这不太可能。
【讨论】: