How and why you should use Firebase Dynamic Links in your Android App

How and why you should use Firebase Dynamic Links in your Android App

URLs used to be straightforward. You’d type one in, and most times, you’d be taken to a website. Simple, right?

Enter the mobile age where much of the operating system is powered by apps outside of the traditional browser. Deep Links were a theory that could make browser-application integration seamless. You’d click a deep link from your browser, and it would take you to an app with data carried over so your app could present say, a special welcome message, or maybe even bonus features for your game depending on where you came from.

Although it was great in theory, in practice, it’s not so simple. Deep links would have trouble working across different platforms (Android, iOS). They would sometimes malfunction if you didn’t have the app already installed, and even if they didn’t, if they prompted you to install that app, they would lose the data they carry during the app installation process.

Enter Firebase Dynamic Links

Firebase Dynamic Links are essentially deep links that overcame all these problems. That means you can present a dynamic link from a browser that would give your users bonus features if they have your app installed. If they didn’t have it installed, Dynamic Links could take you to the Play Store (or your website) to install the app and still present the user with the same bonus features after the app is installed.

Common Use Cases?

As you might guess, the main purpose of Dynamic Links is to get you more users engaged in your app. How does it do this? Well well well…

Converting Web Users to App Users

This might be what you already had in mind. Dynamic Links could be presented in the browser and after installation, the user could be brought to where he left off in the browser so the process is kept smooth.

Social, Email, and SMS Campaigns

For users subscribed to your newsletter, or perhaps your followers on Twitter, you can use Dynamic Links to give special offers in your app (whether or not they already have it installed), not only increasing the number of users converted into your app users, but also giving others more incentive to tune in to your campaigns.

User-to-User Sharing

Word of mouth is real powerful once you manage to get it going. Help make it happen by making it easy to share your app, perhaps giving more incentive for people to talk about it with their peers by offering special rewards for both users.

Real World App Sharing

QR Codes are a thing. Integrate the dynamic link in a QR Code displayed outdoors and give the general public incentive to install your app.

These examples were taken from the Firebase Official Docs, and it goes to show how versatile a simple working deep link can be.

How to Make a Dynamic Link

There are 4 ways to create Dynamic Links:

  • Using the Firebase Console
  • Using the Dynamic Link Builder API on Android and iOS
  • Using the REST API
  • Manually (through parameters and such)

We’ll explore just the Firebase Console method here and cover the rest in the following weeks.

Using the Firebase Console

  1. Go the Firebase Console and head to Dynamic Links. You start by creating your own subdomain to host your links. Make it unique.
  2. Now you’ll be able to create a Dynamic Link. Follow through the fields defining its short and full URL link (which it will navigate to on Desktop devices) as well as its behavior on iOS and Android devices.

How to Receive Dynamic Links

Start by adding this intent filter to your  AndroidManifest.xml file, under the activity that should open the deep link.

In the activity’s onCreate method, get the dynamic link (as you would an Intent) and add success and failure listeners.

In the onSuccess method, you’ll be given access to PendingDynamicLinkData which as you might guess, is where you can retrieve the link and the data that comes with it.

Conclusion

This was barely scraping the surface of Dynamic Links. In the following weeks, we’ll explore the different methods of creating links, as well as some examples of how to apply the use cases above after receiving them. Stay tuned.