At Branch, we have noticed something obvious: app developers often want to link directly into other apps. It sounds simple, but this is often frustratingly difficult to implement. That’s why we’re excited to announce a brand new, open-source SDK named Roots to help app developers do just that. This is a standalone project, completely separate from our core Branch deep linking service, and we are releasing it to the community for free use, forever. You can grab the iOS version here and the Android version here.
Here’s an example of where Roots can make your life much easier: you have a recipe app, and you want connect with a grocery delivery app so that with just the press of a button, your user would magically get a pre-filled shopping list of all the ingredients necessary for dinner. Of course this is a match made in heaven, but there are two big issues involved in actually making everything work:
- You have to know if the grocery app is installed. And if it isn’t, you need to send your recipe reader somewhere else (probably to the website or the App/Play Store)
- You need to preserve the “context” between apps. Your recipe ingredients have to arrive in a way that the grocery app can understand
Because of the complexity involved, apps that even try to implement this all do so differently. The end result is extremely fragmented linking behavior and frustrated users who don’t know what will happen when they click a link. Facebook, Twitter, Gmail, Safari, and Chrome, all respond differently.
The issue of preserving context with links didn’t exist on the web prior to the introduction of native apps. As their name suggests, URLs (a.k.a., Uniform Resource Locators) come with context embedded by definition, and because every web browser in the world supports http:// (and https:// by extension), you never have to worry that links won’t work. Fortunately with the introduction of iOS Universal Links and Android App Links, the mobile ecosystem has slowly begun to recognize that native apps are usually preferable to mobile websites. We propose making this behavior the industry standard, effectively extending the basic functionality of HTTP links to include apps. This is what the new Roots SDK is designed to do.
When implemented in an app, Roots automatically detects website/app connections and will deep link into the destination app if is installed. If not, the corresponding website will load instead. If there’s no corresponding website, the appropriate App/Play Store page will open.
What about App Links?
Apple and Google have proprietary deep linking solutions for their platforms, but there is a third elephant in the room: Facebook. Facebook doesn’t want users leaving its core apps at all, but if this must happen, then Facebook definitely doesn’t want Apple and Google to be the gatekeepers. At F8 back in 2014, Facebook launched their own open-source App Links standard with much fanfare and a star-studded list of partners. The stated goal of the App Links project was to create an industry standard for deep linking between apps. App Links works by embedding special metadata tags in normal web pages, creating a connection between the web page and an equivalent piece of in-app content.
This is a brilliant cross-platform solution, but there were a few big issues:
- Because Apple and Google certainly had no intention of supporting Facebook’s standard at the OS level, implementation falls onto individual apps.
- Facebook did an admirable job of defining the spec and how to implement it on the web side, but a terrible job at providing implementation resources to app developers.
- Over the last two years, even Facebook has failed to fully support their own standard.
What the Roots SDK Improves
Here’s the situation today: the App Links spec is robust and already widely implemented on the web, but very few apps are configured to take advantage of it. We see this as a wasted opportunity, so we decided to fill in the gaps.
Introducing the Roots SDK: an independent, self-contained library for iOS and Android that takes care of all the in-app App Links implementation details for you. If you want to launch another app from within your own, all you need to do is pass Roots a web URL corresponding to content you want. Roots will instantly parse all the App Links tags at that URL and open the destination app if it is installed. If not, you can define whether you want the user to be sent to the App/Play Store, or the web fallback URL.
On the other side, Roots provides a simple routing function to implement inside the destination app. It piggybacks on top of all the usual deep link standards (iOS Universal Links, Android App Links, and custom URI schemes) to automatically parse incoming App Links traffic and allow you to route the deep link where you want. And here’s the best part: if the URL you feed into Roots happens to be a Branch link (all Branch links conform to the App Links spec), then the context of the link will be preserved, even if the destination app is not yet installed. This means after the user installs the app and opens it the first time, they will still be sent to the right place.
A Real Life Example of Roots
With the example above, a Roots implementation would look like this:
- In the recipe app, define all the grocery items needed for a given recipe.
- On the grocery app’s website, build a page (either manually or programmatically) containing a list of those grocery items, and add App Links tags to identify it and pass the context (the items) through to the grocery app itself.
- Inside the recipe app, pass the URL of this page to the Roots SDK.
- If the grocery app is installed, it will open immediately. If not, the web page will load instead.
- Inside the grocery app, use the routing function built into Roots to parse the incoming context (the items) and add them to the user’s cart.
Where Branch Links Fit In
If you are still wondering whether Branch and Roots work together, and whether you can use one without the other, the answer is both questions is yes. Roots and Branch are completely separate, but are a perfect complement for each other. When a Branch link is passed to Roots, the destination app gets access to attribution data and deferred deep linking through install, just like all other Branch link traffic. For the recipe and grocery example, all you would need to do is create a Branch link containing data keys for each ingredient, and then pass that link URL into Roots.
Our hope is that Roots makes life a little bit easier for mobile app developers everywhere, and we can’t wait to see the new experiences you will build. Let’s go fix the mobile linking ecosystem.