简体   繁体   English

对于 Firebase 动态链接,utmParameters 始终为空

[英]utmParameters is always empty for a Firebase Dynamic Link

I've created several dynamic links with UTM parameters using the Firebase console.我使用 Firebase 控制台创建了几个带有 UTM 参数的动态链接。 Yet, the utmParameters field is always empty.然而, utmParameters字段始终为空。

By the time the intent is received the UTM parameters have been stripped off.当收到intent时,UTM 参数已被剥离。 We want to use these parameters for additional tracking and decision-making in the app.我们希望使用这些参数在应用程序中进行额外的跟踪和决策。

Any ideas what could be going wrong here?任何想法这里可能出了什么问题? Thanks谢谢

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    Firebase.dynamicLinks
        .getDynamicLink(intent)
        .addOnSuccessListener(this) { pendingDynamicLinkData ->
            var deepLink: Uri? = null
            if (pendingDynamicLinkData != null) {
                deepLink = pendingDynamicLinkData.link

                Timber.tag("XXX").d("UTM :${pendingDynamicLinkData.utmParameters}")
            }
        }
        .addOnFailureListener(this) { e -> Timber.e(e, "Failed to process Dynamic Link") }
}

I find the same problem and what solve it for me is start using the method that expects an Uri instead of Intent.我发现了同样的问题,对我来说解决它的方法是开始使用需要 Uri 而不是 Intent 的方法。

intent.data?.let {
    Firebase.dynamicLinks.getDynamicLink(it)
        .addOnSuccessListener(this) {
            ......
}

The URI worked for me. URI 对我有用。 The Java equivalent code: Java 等效代码:

FirebaseDynamicLinks.getInstance().getDynamicLink(getIntent().getData())

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM