如何从网页打开Android应用程序? [英] How to open android application from a webpage?

查看:257
本文介绍了如何从网页打开Android应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过HTML调用我的应用吗?

can I call my app from HTML?

例如:我可以通过我的应用正确使用此代码调用网页。

for example:I can call webpage with this code correctly from my app.

android代码:

  startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(
                                    "myDomain.com")));

在我的网站上做某事后,我想再次打开我的Android应用程序。

and after doing something in my site, I want to open my android app again.

我找到了这段代码,

<a href="market://details?id=info.androidhive.slidingmenu">

但是只需拨打市场查找并安装应用程序!

but it's just call Market to find and install the app!

推荐答案

你可以看看这个: 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>

所以你的应用程序将通过以下链接启动:

So your app will be started by this link:

<a href="example://gizmos">

这篇关于如何从网页打开Android应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆