Migrating from Firebase Invites to Dynamic Links with Custom Sharing

Firebase Invites provided both a mechanism for receiving Firebase Dynamic Links in your app, as well as a feature to share that link via SMS or email. We developed Firebase Invites to help you grow your app users through word of mouth, but over time, we learned that you found better ways to encourage users to share their favorite apps with their friends, beyond what Firebase Invites does today.

We also saw that while usage of Firebase Invites dropped, many of you were still using Firebase Dynamic Links as the key ingredient of your user-to-user sharing solution. So, we’re strengthening our focus and increasing our effort to make Firebase Dynamic Links the best way to build user-to-user sharing capabilities into your app. As part of this shift, we have deprecated the Firebase Invites feature, and will discontinue support starting on January 24th, 2020.

What does this mean and how does it impact me?

Starting on January 24th, 2020, your users will no longer be able to send or receive Firebase Invites, and the invites backend service will start returning error responses when making calls to send and receive an invite link. The current SDKs include error handling to help ensure graceful failure cases for these server responses, so your users will be able to continue using your app without crashing, but we recommend that you no longer use Firebase Invites, and switch to an alternative solution using Firebase Dynamic Links with a custom sharing solution.

Here is how to do that!

First, Create a Dynamic Link that your users can share with their friends. The good news is that you’re likely familiar with this step already because it’s similar to how you set up Firebase Invites. But you can also add specific parameters to your Dynamic Link, such as adding social metadata to your links if your users share your app via a social network to customize the appearance of the URL that gets shared.

Build a sharing solution

Next, build your sharing solution for your users to be able to share that link with their friends. What you will want to build here will vary depending on how you want to provide the sharing feature that will replace the previous one in Firebase Invites, but for most mobile apps you can take advantage of features already built into the platform.

For Android, one simple solution that covers both SMS and email sharing, as well as other popular social network and messaging apps, is to use a generic intent with an action set as Intent.ACTION_SEND. This provides a convenient way to share data from your app to any app the user has installed that can handle a share intent.

Something similar to the following example should work here (recommending that you use constant string resources in your own code):

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "Here's a new lesson for" +
        " learning more Miwok vocabulary:\n\n" + dynamicLink);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Let's Learn Miwok!");
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent,
        getResources().getText(R.string.send_to)));

For a fuller example and more details, check out this guide for sending simple data to other apps.

The code snippet above will generate something like invitation flow shown in the screens below:

Sharing on Android

For iOS developers, you can use a UIActivityViewController, passing in the link created as part of the data to the custom VC. This method would provide a sharing flow similar to the screens below:

Sharing on iOS

Receive a Dynamic Link in your app

Finally, the last step to provide user-to-user sharing for your app after the sunset is in receiving a Dynamic Link in your app.

For Android, this process remains the same so you won’t need to change much here. The only difference is that without Firebase Invites, there will no longer be an invitation ID, and so you would need to remove the call to extract the invite ID via FirebaseAppInvite invite = FirebaseAppInvite.getInvitation(data), if your app is making that call. For more details on this piece, please see the guide on Receiving Dynamic Links in your Android app.

For iOS, this would require changing from the FIRReceivedInvite object to the FIRDynamicLink object, which both contain similar data. Please see the guide on Receiving Dynamic Links in your iOS app for more details.

For Unity developers, there are a number of open-source libraries and equivalent solutions as those described above to migrate your user-to-user sharing functionality. If you need any assistance on providing a suitable solution, please reach out to the support resources linked further below.

Firebase Invites has been a great tool that we're proud to have built. As we look towards the future, we're excited to double down on making Firebase Dynamic Links even better so you have more flexibility and control over how you encourage users to invite others to your app. If you have any questions about setting up your Firebase Dynamic Links and custom sharing solutions, please reach out on StackOverflow, or any of our additional support forums.