从Kotlin中的查询参数Url中提取字符串值

时间:2020-10-31 08:28:54

标签: firebase kotlin firebase-dynamic-links query-parameters

我正在接收深链接url形式的单个密钥:https://example.in/?meetingCode=usertest?meetingToken%3DtZSI6InN5c3Rl7RfdQ4JEbnMkBfNmanH6VrRC4FzcFgOJEU2BmJEBAzo

我想从中检索MeetingCode和MeetingToken字符串值。当前,它正在提取MeetingCode或MeetingToken的值。如何提取两个字符串?

deepLink?.getQueryParameter("meetingCode")deeplink?.queryParameter("meetingToken)

这是代码:

 private fun handleDynamicLink() {
    Firebase.dynamicLinks
        .getDynamicLink(intent)
        .addOnSuccessListener { pendingDynamicLinkData ->
            val deepLink: Uri?
            if (pendingDynamicLinkData != null) {
                deepLink = pendingDynamicLinkData.link

                deepLink?.getQueryParameter("meetingCode")?.let { joinMeeting(it) }

            }
        }
        .addOnFailureListener { _ ->
            toast(getString(R.string.main_error_fetch_dynamic_link))
        }
}

请帮助我实现它。谢谢

0 个答案:

没有答案