How to launch instantapp from web pages in Chrome?

1.4k Views Asked by At

I developed my first Android instant app which is now available on Google Play.
I want to invoke the app from a web page in Chrome, but it doesn't work.

Taking Wish (www.wish.com) as an example, I tried the following links on 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>

But neither link above does work (clicking them just navigates to the Web page of Wish, but no instant app shows up), Although the second one seems to be what Google is using in their search result page.

I also confirmed the app can be launched via an am command like:

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

Does anybody know how to launch instant apps from a web page?

Android 7.0 on Galaxy S8
Chrome for Android 60.0.3112.116

2

There are 2 best solutions below

1
On BEST ANSWER

I found solution for this problem by create dynamic links from Firebase Dynamics Links https://firebase.google.com/docs/dynamic-links in Firebase console. There is an option for send user to instant apps when the app isn't installed. I found it from https://developer.android.com/topic/instant-apps/faqs.html (in App Links, deep linking, and URL handling section)

Like this

Sorry for my English.

0
On

Only Firebase Dynamics Links can open instant app from web. You can easy generate it manually but first check how it work in firebase console. Use Link Details and Link Preview once you created test link.

Example Link:

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

Example instant app configuration in manifest:

    <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>