【问题标题】:Android : Firebase dynamic link always goes to playstore URL even if the app is installedAndroid:Firebase 动态链接始终会转到 Playstore URL,即使已安装应用程序也是如此
【发布时间】:2019-06-26 18:39:34
【问题描述】:

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

当我在https://firebase.google.com/docs/app-indexing/android/test 测试时 动态链接很好地转到应用程序。因为应用已安装。

我在我的应用中添加了 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();

【问题讨论】:

  • 检查您在 firebase 中使用的包名称和应用的包名称。确保它们相同
  • @HemilKumbhani 一样..
  • 我面临同样的问题,但仅在一个设备中,而不是特定的型号,因为它工作的相同型号的不同设备。在我的摩托罗拉 x4 测试设备之一中。

标签: java android firebase firebase-dynamic-links


【解决方案1】:

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

在actionCodeSetting中,

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

改成

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

但我不知道为什么将 * installIfNotAvailable * 选项更改为 false 才起作用..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-12
    • 2020-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-23
    • 1970-01-01
    相关资源
    最近更新 更多