【问题标题】:How to launch instantapp from web pages in Chrome?如何从 Chrome 中的网页启动 Instantapp?
【发布时间】:2017-09-10 09:51:44
【问题描述】:

我开发了我的第一个 Android 免安装应用,现在可以在 Google Play 上使用。
我想从 Chrome 中的网页调用该应用,但它不起作用。

以Wish(www.wish.com)为例,我在Chrome for Android上尝试了以下链接。

1:<a href="https://www.wish.com/">link1</a>

2:<a href="intent://www.wish.com/#Intent;action=com.google.android.instantapps.START;scheme=https;package=com.google.android.instantapps.supervisor;S.browser_fallback_url=https%3A%2F%2Fwww.wish.com%2F;S.android.intent.extra.REFERRER_NAME=https%3A%2F%2Fwww.google.co.jp;launchFlags=0x8080000;end">link2</a>

但是上面的链接都不起作用(点击它们只是导航到 Wish 的网页,但没有显示即时应用),虽然第二个似乎是谷歌在他们的搜索结果页面中使用的。

我还确认可以通过am 命令启动该应用,例如:

am start -a com.google.android.instantapps.START -c android.intent.category.BROWSABLE -d https://www.wish.com/

有人知道如何从网页启动即时应用程序吗?

Galaxy S8 上的 Android 7.0
适用于 Android 的 Chrome 60.0.3112.116

【问题讨论】:

标签: android google-chrome android-intent android-instant-apps


【解决方案1】:

我通过在 Firebase 控制台中从 Firebase Dynamics Links https://firebase.google.com/docs/dynamic-links 创建动态链接找到了解决此问题的方法。 未安装应用程序时,可以选择将用户发送到即时应用程序。我是从https://developer.android.com/topic/instant-apps/faqs.html 找到的(在应用链接、深度链接和 URL 处理部分)

Like this

对不起我的英语。

【讨论】:

  • Firebase 动态链接运行良好。谢谢 Saran、Andoctorey 和 Prags。对于迟到的回复,我深表歉意。
【解决方案2】:

只有 Firebase Dynamics Links 可以从网络打开免安装应用。您可以轻松生成它manually,但首先检查它在 firebase 控制台中的工作方式。创建测试链接后,使用链接详细信息和链接预览。

示例链接:

https://firebase.page.link/?link=https://instant.example.com&apn=package_name&afl=https://example.com

清单中的免安装应用配置示例:

    <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:scheme="http" />

            <data
                android:host="instant.example.com"
                android:pathPrefix="/"
                android:scheme="https" />
        </intent-filter>

        <meta-data
            android:name="default-url"
            android:value="https://instant.example.com" />
    </activity>

【讨论】:

    猜你喜欢
    • 2023-04-08
    • 2010-10-29
    • 2021-01-02
    • 1970-01-01
    • 2016-08-06
    • 2011-08-22
    • 1970-01-01
    • 2011-07-14
    • 1970-01-01
    相关资源
    最近更新 更多