Android : Firebase 动态 link 总是去 playstore URL 即使应用程序已安装

Android : Firebase dynamic link always goes to playstore URL even if the app is installed

我正在尝试将 Firebase 动态 link 集成到 Android 应用程序中,但问题是即使安装了该应用程序,动态 link 也会让我播放商店页面从 Play 商店下载应用程序。 我发送了带有动态 link 的电子邮件。然后在 Android 智能手机上,我打开电子邮件并单击动态 link,它总是去 play store.. 有没有人遇到同样的问题并有相同的解决方案。

当我在 https://firebase.google.com/docs/app-indexing/android/test 测试时 动态 link 很好地进入应用程序。因为安装了应用程序。

我在我的应用程序中添加了 SHA-1、SHA-256 密钥。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.chillingchat.android">

<uses-permission android:name="android.permission.INTERNET" />

<application
    android:allowBackup="true"
    android:icon="@drawable/adv"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    >
    <activity
        android:name="io.chillingchat.android.view.MainActivity"
        android:label="@string/app_name">

    </activity>

    <activity
        android:name="io.chillingchat.android.view.AuthActivity">

        <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"/>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <data
                android:host="chillingchat.io"
                android:scheme="https"/>
            <data
                android:host="chillingchat.io"
                android:scheme="http"/>
        </intent-filter>
    </activity>


</application>

actionCodeSettings = ActionCodeSettings.newBuilder()
            // URL you want to redirect back to. The domain (www.example.com) 
            // URL must be whitelisted in the Firebase Console.
            .setUrl("https://chillingchat.page.link/in")
            // This must be true
            .setHandleCodeInApp(true)
            .setAndroidPackageName(
                    "io.chillingchat.android",
                    true, /* installIfNotAvailable */
                    "16"    /* minimumVersion */)
            .build();

我终于解决了这个可怕的问题。

在actionCodeSetting中,

.setAndroidPackageName(
                "io.chillingchat.android",
                true, /* installIfNotAvailable */
                "16"    /* minimumVersion */)

改为

.setAndroidPackageName(
                "io.chillingchat.android",
                false, /* installIfNotAvailable */
                "16"    /* minimumVersion */)

但我不知道为什么将 true 更改为 false * installIfNotAvailable * 选项使工作..