首次打开时无法从gplay获得深层链接

时间:2019-03-25 13:47:20

标签: android google-play firebase-dynamic-links android-deep-link

我在我的应用中将firebase动态链接用于引荐程序。在本教程https://firebase.google.com/docs/dynamic-links/use-cases/rewarded-referral中编写所有类似内容。一切正常,然后在安装后从Google Play应用打开应用。但是,如果从启动器打开的应用程序的深层链接为null。我该如何解决? 链接:https://play.google.com/store/apps/details?id=my.super.app&pcampaignid=fdl_long&url=https://mysite.uk/?ref=1234&link=https://mysite.uk/?ref=1234

private fun saveDynamicLink() {
        intent.data?.let {
            userInteractor.saveReferral(it.toString())
            println("DEEP LINK intent data $it")
        }
        task = FirebaseDynamicLinks.getInstance()
                .getDynamicLink(intent)
                .addOnCanceledListener {
                    println("DEEP LINK CANCELED ")
                }
                .addOnCompleteListener {
                    println("DEEP LINK COMPLETE $it")
                }
                .addOnSuccessListener(this) { pendingDynamicLinkData ->
                    var deepLink: Uri? = null
                    if (pendingDynamicLinkData != null) {
                        deepLink = pendingDynamicLinkData.link
                        userInteractor.saveReferral(deepLink.toString())
                    }
                    println("DEEP LINK IS : ${deepLink.toString()}")
                }
                .addOnFailureListener(this) { e ->
                    println("DEEP LINK error $e")
                    e.printStackTrace()
                    MyLog.logException(e)
                }
    }

0 个答案:

没有答案