Dynamic Links
Firebase Dynamic Links are links that work the way you want, on multiple platforms, and whether or not your game is already installed.
With Dynamic Links, your users get the best available experience for the platform they open your link on. If a user opens a Dynamic Link on iOS or Android, they can be taken directly to the linked content in your native game. If a user opens the same Dynamic Link in a desktop browser, they can be taken to the equivalent content on your website.
In addition, Dynamic Links work across game installs: if a user opens a Dynamic Link on iOS or Android and doesn’t have your game installed, the user can be prompted to install it; then, after installation, your game starts and can access the link.
You create a Dynamic Link either by using the Firebase console, using a REST API, iOS or Android Builder API, or by forming a URL by adding Dynamic Link parameters to a domain specific to your game. These parameters specify the links you want to open, depending on the user’s platform and whether your game is installed.
When a user opens one of your Dynamic Links, if your game isn’t yet installed, the user is sent to the Google Play Store or App Store to install your game (unless you specify otherwise), and your game opens. You can then retrieve the link that was passed to your game and handle the link as appropriate for your game.
How does it work?
You create a Dynamic Link either by using the Firebase console, using a REST API, iOS or Android Builder API, or by forming a URL by adding Dynamic Link parameters to a domain specific to your game. These parameters specify the links you want to open, depending on the user’s platform and whether your game is installed.
When a user opens one of your Dynamic Links, if your game isn’t yet installed, the user is sent to the Google Play Store or App Store to install your game (unless you specify otherwise), and your game opens. You can then retrieve the link that was passed to your game and handle the link as appropriate for your game.
Initialization
Before making any call to the Firebase Dynamic Links, you should first execute the Firebase Dynamic Links Init function. If the result is a fail, study logs to find out what causes an issue.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki81.png
Create Dynamic Links
There are three ways you can create a Dynamic Link:
- Using the Firebase console. This is useful if you’re creating one-off links to share on social media.
- Using plugin’s runtime functions on iOS and Android. This is the preferred way to dynamically create links in your game for user-to-user sharing or in any situation that requires many links. You can track the performance of Dynamic Links created with the runtime functions using Firebase Analytics.
- Manually. If you don’t need to track click data and you don’t care if the links are long, you can manually construct Dynamic Links using URL parameters, and by doing so, avoid an extra network round trip.
You can create short or long Dynamic Links using Ultimate Mobile Kit plugin. The API takes several optional parameter structures to build links. Short links can also be created from a previously generated long link. Firebase Dynamic Links generates a URL like the following:
Create a long Dynamic Link
To create a Dynamic Link, create a Firebase Dynamic Link Components structure, setting any of the optional members for additional configuration, and passing it to Firebase Dynamic Link Get Short Link or Firebase Dynamic Link Get Long Link.
The following minimal example creates a long Dynamic Link to https://gamednastudio.com that opens with your Android game com…firebase and iOS game com…firebase:
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki82.png
Long Links append all of the configuration settings as query arguments to the link and therefore do not require any network calls.
Create a short Dynamic Link
To create a short Dynamic Link, pass a previously generated long link to Firebase Dynamic Links Get Short Link or build Firebase Dynamic Link Components the same way as above.
Firebase Dynamic Links Get Short Link optionally takes an extra Firebase Dynamic Link Options config parameter with Path Length; this allows you to control how the link should be generated. Generating a short link requires a network request to the Firebase backend, so Firebase Dynamic Links Get Short Link is asynchronous.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki83.png
Receive Dynamic Links
To check for a received Dynamic Link, call Firebase Dynamic Links Get Listener function and bind event OnDynamicLinkReceivedEvent.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki84.png
You must also call Firebase Dynamic Links Fetch when the application runs or gains focus in order for the listener to be triggered.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki85.png