gpt4 book ai didi

android - Firebase 动态链接始终为空

转载 作者:行者123 更新时间:2023-12-05 00:02:23 26 4
gpt4 key购买 nike

我很难在 Android 中正确配置 Firebase 动态链接。 (相同的动态链接在 iOS 中工作正常)
我从 Firebase 控制台创建了一个动态链接。生成的链接是这样的:
https://myexample.page.link/XzPY
这是 Firebase 中的配置:
enter image description here
在 list 中,我添加了这个 Intent 过滤器:

<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="myexample.page.link"
android:scheme="https" />
</intent-filter>
此外,Android 的行为已设置为“在您的 Android 应用程序中打开深层链接”。
这是应该在我的 Activity 中处理动态链接的部分:
Firebase.dynamicLinks
.getDynamicLink(intent)
.addOnSuccessListener(this) { pendingDynamicLinkData -> // ALWAYS NULL!
var deepLink: Uri? = null
if (pendingDynamicLinkData != null) {
deepLink = pendingDynamicLinkData.link
}
}
如果我尝试从浏览器(从我的笔记本电脑)打开链接,我会看到它被重定向到正确的页面。如果我尝试从 Android 打开相同的链接,我会看到两个错误的东西:
  • 该链接不会将我重定向到应用程序,但会显示选择应用程序或浏览器的选项。
  • 如果我选择应用程序,则待处理的动态链接数据始终为空。
  • 最佳答案

    尝试添加这个

        <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="YOUR_HOST_LINK"
    android:scheme="http" />
    <data
    android:host="YOUR_HOST_LINK"
    android:scheme="https" />
    </intent-filter>




    FirebaseDynamicLinks.getInstance().getDynamicLink(intent)
    .addOnSuccessListener { pendingDynamicLinkData ->
    if (pendingDynamicLinkData != null) {

    }

    关于android - Firebase 动态链接始终为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70082147/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com