【问题标题】:how we open an android application from an html button when open in phone browser在手机浏览器中打开时,我们如何从 html 按钮打开 android 应用程序
【发布时间】:2014-05-22 19:12:59
【问题描述】:

如果 html 页面在安卓手机浏览器中打开,我只需要在单击 html 页面按钮时打开应用程序。

对不起我的英语。

请建议。

提前致谢

【问题讨论】:

    标签: android


    【解决方案1】:

    您可以将应用程序的Main-activityintent-filter 设置如下,以从浏览器打开此应用程序。

     <activity
            android:name="activity_name">
            <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
    
            <data
                android:host="example.com"
                android:scheme="http" />
            <data
                android:host="www.example.com"
                android:scheme="http" />
        </intent-filter>
    </activity>
    

    编辑: 如果你已经写了&lt;intent-filter&gt; 上面提到的你的活动,那么你可以在 html 按钮上打开你的应用程序,如下所示。

    点击 html 页面按钮调用 url http://www.example.com

    示例:

    <input type=button onClick="parent.location='http://www.example.com'" value='Open App'>
    

    【讨论】:

    • 请您提供一些示例代码链接...我花了几个小时但仍然没有进展。请帮帮我
    【解决方案2】:

    可以从深层链接启动已安装的应用程序。

    Deep Linking

    【讨论】:

      猜你喜欢
      • 2012-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-20
      • 2017-11-06
      • 2014-05-29
      • 2015-07-12
      • 2020-09-07
      相关资源
      最近更新 更多