Google Chrome does not open application on Deep Link on Android

痞子三分冷 提交于 2019-12-23 12:13:13

问题


Google Chrome wouldn't launch my app on Deep Link, however, the app gets launched if I run it from Firefox. I use "onkat://" just as an example as I just want to get the app launched first.

Following is the code in my AndroidManifest.xml

<activity
            android:name="MainActivity"
            android:configChanges="keyboardHidden|screenSize|orientation"
            android:icon="@drawable/something"
            android:label="@string/appName"
            android:launchMode="singleTask"
            android:screenOrientation="user" >

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <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:scheme="onkat"/>

            </intent-filter>
</activity>

Any ideas? If Google Chrome requires anything more in the Intent-filter? or a work-around. I tested on multiple devices, except Chrome the other browsers run my app when I simply enter "onkat://"

Observation: I think Google Chrome doesn't work with Deep Link in general. Even Facebook deep link doesn't work on it, while it works on other browsers (fb://). Also, google chrome Deep Link doesn't work for iOS


回答1:


In the manifest file your intent filter should be like this:

        <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="productlist"
                android:path="/"
                android:scheme="westwing" />
        </intent-filter>

and on the browser side it should be like this:

"intent://productlist/#Intent;scheme=westwing;package=de.westwing.android;end"



回答2:


Chrome has changed how it handles intents launched from the Chrome browser app.

<a href="intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end"> Take a QR code </a>

The answer can be found here: https://developer.chrome.com/multidevice/android/intents



来源:https://stackoverflow.com/questions/29189172/google-chrome-does-not-open-application-on-deep-link-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!