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
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
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()
}
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)
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);