Android-10 DeepLink无法正常运行,但可在android 10版本以下运行

问题描述

我正在使用一个Android应用,其中我在用深层链接网址盯着登录活动 这就是我正在使用的意图。

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

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

            <data
                android:host="www.mySite.com"
                android:path="/launch.PHP"
                android:scheme="http"
               ></data>
            <data
                android:host="www.mySite.com"
                android:path="/launch.PHP"
                android:scheme="https" />

        </intent-filter>
    </activity>

代码适用于除android 10以外的所有android版本, 我应该怎么做才能使其在android 10上工作。我找不到专门针对android 10的东西。 谢谢。

解决方法

我认为您之前执行的是“ scheme:// host / path”之类的东西,但是我认为Chrome无法处理Android 10及更高版本的URI方案。现在是推荐的方案:

intent:// host / path#Intent; scheme = scheme; package = com.example.app.package; end

请参阅此参考资料:https://developer.chrome.com/multidevice/android/intents

我还发现this tool handy是在移动设备上查看工作示例的地方。对于您的应用,您可以尝试从javascript或网络浏览器启动此URL:

intent://www.mySite.com/launch.php#Intent;scheme=http;package=your.app.package;end