extract query parameters from deeplink in kotlin

Finally it is resolved:

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

val roomCode = deepLink?.getQueryParameter("roomCode")?.substringBefore("?roomToken=","")

val roomToken = deepLink?.getQueryParameter("roomCode")?.replace("roomToken","roomToken")?.substringAfter("?roomToken=","")

                    if(roomCode !=null && roomToken != null) {
                        joinMeeting(roomCode, roomToken)
                    }


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

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top