Firebase dynamic link support custom parameters?

后端 未结 10 1277
野趣味
野趣味 2020-12-29 04:25

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=fccfc

相关标签:
10条回答
  • 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

    0 讨论(0)
  • 2020-12-29 05:11

    1) From https://console.firebase.google.com/ (no need for custom parameter 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()
            }
    
    0 讨论(0)
  • 2020-12-29 05:14

    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)

    0 讨论(0)
  • 2020-12-29 05:20

    For web apps, which generating dynamic links.

    const data = {
      dynamicLinkInfo: {
        domainUriPrefix: 'subdomain.page.link',
        link: url,
      },
      suffix: {
        option: 'SHORT'
      }
    };
    return fetch(`https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=${environment.firebaseConfig.apiKey}`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(data),
    }).then(res => res.json()).then(response => response.shortLink).catch(console.error);
    
    0 讨论(0)
提交回复
热议问题