Firebase Short link Creation
You might have heard about dynamic linking (in context of App/web development) which is nothing but a deeplink to your website/APIs. It makes transition very easy between different platform.
Its a service provided by firebase to generate dynamic short link with very easy APIs so that you don’t have to worry how to handle every device redirection like Android, IOS or Web.
And Best of all Its FREE(For Now).
So there are two types of Dynamic Link(Both works the same as far as application developer is concerned)
- Long Dynamic Link
- Short Dynamic Link
Long Dynamic Link
Its a type of link which contains all raw information and are usually very long. So it becomes very difficult to sent over SMS(cause of length limitation).
One benefit of long dynamic link is that you don’t have too worry about additional network call to firebase server for creating other type of dynamic link(short link).
https://example.page.link/?link=https://www.example.com/&apn=com.example.android&ibi=com.example.ios
Short Dynamic Link
Its a type of link which just contains a unique hash based link which is quite short in length. Hash is calculated by Firebase server itself, you can not create custom firebase short link . As its short, it can be sent over an SMS.
https://example.page.link/WXYZ
So here I have written a simple Dynamic Link Generation function in Golang.
I have hardcoded the parameters but you can use the OS’s environment variable or some configuration file.
Here I am first manually creating dynamic link (which you can use without any issue), then using that long dynamic link you can create short dynamic link with the help of firebase APIs.
Make sure to remove firebase API key when using long dynamic link, it’s not required.
You might be tempted to use this always, but it has its own drawback when compared with raw deeplinking in android/IOS. For example Dynamic link does not support multiple android APN or IOS bundle.
Thanks for reading…
Let me know your thoughts in the comment section below