Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase dynamic link support custom parameters?

I am writing a App for a Open Source Conference.

Originally each attendees will receive different link via email or SMS like

https://example.com/?token=fccfc8bfa07643a1ca8015cbe74f5f17

then use this link to open app, we can know the user is which attendee by the token.

Firebase release a new feature Dynamic Links in I/O 2016, it provide better experience for users.

I had try that, but I can't find any way to pass the custom parameters (the token) in dynamic links, how to use the same link with different parameters to my users?

Thanks.

like image 862
Denny Huang Avatar asked Jul 09 '16 17:07

Denny Huang


People also ask

How does Firebase dynamic links work?

Dynamic Links are smart URLs that allow you to send existing and potential users to any location within your iOS or Android app. They survive the app install process, so even new users see the content they're looking for when they open the app for the first time. Dynamic Links are no-cost forever , for any scale.

Do Firebase dynamic links expire?

As far as I know, dynamic links work for as long as your firebase project active. I used some dynamic links more than one year after they were created. I didn't see anything about any time limits in the documentation.

How do you debug a Firebase dynamic link?

To help you debug your Dynamic Links, you can preview your Dynamic Links' behavior on different platforms and configurations with an automatically-generated flowchart. Generate the flowchart by adding the d=1 parameter to any short or long Dynamic Link. For example, example. page.


4 Answers

I don't think you can use the short url: https://<my app>.app.goo.gl/Gk3m unless you create one for each user, but you can use the long url: https://<my app>.app.goo.gl/?link=https://example.com/?token=fccfc8bfa07643a1ca8015cbe74f5f17 ...(add other parameters as needed) and set new token for each user.

I assume you generate the tokens automatically. In that case you can use this to shorten the links.

like image 74
diidu Avatar answered Oct 19 '22 22:10

diidu


1) From https://console.firebase.google.com/ (no need for custom parameter here.)

enter image description here

2) Create link somewhere, f.e. on your confluence page (here we add our parameter):

https://PROJECTNAME.page.link/?link=https://PROJECTNAME.page.link/LINKNAME?PARAMETER=1&ofl=https://www.PROJECTNAME.com/

PARAMETER is your custom parameter.

ofl is a link where to go if click the link from another platform (PC, Mac).

3) Getting link data from android project Kotlin code:

Firebase.dynamicLinks
        .getDynamicLink(intent)
        .addOnSuccessListener { pendingDynamicLinkData ->
            val parameter: String =
                pendingDynamicLinkData?.link?.getQueryParameter("PARAMETER").orEmpty()
        }
like image 11
Eugene P. Avatar answered Oct 19 '22 21:10

Eugene P.


If you want to use dynamic links with custom arguments with REST, here is an example of a payload:

{
  "dynamicLinkInfo": {
        "dynamicLinkDomain": "example.app.goo.gl",
        "link": "http://someurl.com?my_first_param=test&my_second_param=test2"
  },
  "suffix": {
     "option":"UNGUESSABLE"
    }
}

Make sure your remove 'https://' from your dynamicLinkDomain

Julien

like image 8
JulienCoo Avatar answered Oct 19 '22 22:10

JulienCoo


Case A. If you want the short link to expand to a link with multiple parameters:

In the part where you setup a dynamic link, any parameter you append to the deep link URL will go on all platforms (web, iOS, android) enter image description here

Case B. If you want to use dynamic parameters, you should use the api to create a short link

see documentation

like image 7
Ted Avatar answered Oct 19 '22 21:10

Ted