Receiving Dynamic Links in Firebase
In this section, we will discuss how we can receive the Dynamic Link. So, for receiving the Firebase Dynamic Links, which we have created before, include the Dynamic Links SDK in our app. We also need to call the FirebaseDynamicLinks.getDynamicLink() method, when our app loads to get the data passed in the Dynamic Link. We must add a new Intent filter to the activity which handles deep link for our app. The intent filter should catch a deep link of our domain since the Dynamic Link will redirect to our domain, if our app is installed. This is required for our app to receive the Dynamic Link data after it is installed/updated from the play store and one tap on the continue button.
When a user opens a dynamic link with a deep link to the scheme and host, which we specified, our app will start the activity with this intent filter to handle the link.
Handle Deep Links
For handling deep links, we have to call the getDynamicLink() method in every activity which might be launched by the link, even though the link might be available from the intent using getIntent().getData(). When we call the getDynamicLink(), it retrieves the link and clears that data, so it is received only once by our app. We can normally call getDynamicLink() in the main activity as well as any activity launched by the intent filter, which matches the link.