Updated for 2019: The Ultimate Android Deep Linking Guide

As time spent within native apps continues to increase for both iOS and Android users, it’s important that you address both operating systems in your 2019 mobile growth plan to make sure you’re leaving no user – and no revenue – behind.

Data collected by eMarketer reveals U.S. adults spent an average of two hours and 35 minutes in-app in 2018 compared to just 26 minutes on the mobile web. The in-app share of U.S. mobile time continues to increase – from two hours and 25 minutes in 2017 and two hours and 11 minutes in 2016 – while time on mobile web remains stagnant.

Average Time Spent Per Day with Mobile Internet Among U.S. Adults, In-App vs. Mobile Web1

This trend is expected to continue, making it more important than ever that marketers and product teams focus on strategies like deep linking to guide users on both iOS and Android into their apps.

Today, we’re going to focus on the Android piece of that puzzle.

 

Android Grows Market Share in 2018

According to data from Statista, Android is the most popular smartphone operating system worldwide, with its market share reaching 85.9% globally and 54.5% in the U.S. in the first quarter of 2018. Statista data shows Android’s majority market share has held steady for the past five years, making it a critical component of app success.

The challenge: Android is one of the most fragmented platforms for developers to manage. This is largely due to Google’s decision to force device manufacturers to be responsible for porting the OS.

One place this fragmentation pops up is deep linking, which Google has attempted to solve by introducing Android App Links – much like Apple’s Universal Links on iOS.

Android App Links are designed to link users directly to in-app content, but this solution is far from perfect. Fragmentation continues to cause thousands of edge cases that take the user to a mobile website or an error message instead. Those errors leave users stranded, instead of in the app where they spend more time and more money (3x more!).

Effective deep linking, and a strategy that stays up-to-date with new releases, ensures your user experience continues to drive customer satisfaction and in-app conversions and engagement.

 

How Deep Linking on Android Drives Better User Experiences – and ROI

Let’s look at an example of a compelling and effective user experience. This example comes from Turner-owned television stations TBS and TNT.

In this flow, web-to-app smart banners link mobile web visitors directly to the in-app version of the content they’re accessing on the mobile web. The content is the same, but the user is now in the native app where they’re most likely to engage.

While this example shows a web-to-app journey, deep links can also optimize Android experiences on email, paid ads, social, and more.

This improved user experience has a substantial impact on ROI. Criteo research shows 66% of mobile transactions occur inside native apps, and native mobile apps drive 3x more sales than mobile web. If your links land users on the mobile web where they’re not logged in, they are far less likely to convert.

Bottom line: If you don’t route users into your native app effectively, you’re losing money.

 

Guidelines for Implementing Deep Links on Android

For those of you who might be new to deep linking or would like a review, here’s a quick refresher on implementing deep links for Android.

In Android 1.0, the Android URI scheme deep linking mechanism was created. It allows the developer to register their app for a URI (uniform resource identifier) in the operating system for a specific device once the app is installed. A URI can be any string without special characters, such as HTTP, pinterest, fb, or myapp. Once registered, if you append ://  to the end (e.g. pinterest://) and click this link, the Pinterest app will open up. If the Pinterest app is not installed, you’ll see a ‘Page Not Found’ error.

Adding support for URI schemes to your app is a prerequisite for building out your own deep linking strategy on Android. While we strongly recommend working with a deep linking partner like Branch to handle the many edge cases and complexities of the Android OS, this guide will provide you with the steps necessary to deep link into your Android app for yourself.

Now, let’s look at how to configure deep links for Android.

Step 1: Configure Your App for an Android URI Scheme

First, you need to pick an Activity within your app that you’d like to open when the URI scheme is triggered, and register an intent filter for it. Add the following code within the <activity /> tag within your manifest that corresponds to the Activity you want to open.

<intent-filter>
	<data android_scheme="your_uri_scheme" />
	<action android_name="android.intent.action.VIEW" />
	<category android_name="android.intent.category.DEFAULT" />
	<category android_name="android.intent.category.BROWSABLE" />
</intent-filter>

 

Ideally, your URI scheme is unique. If it overlaps with another app’s URI scheme, the user will see an Android chooser when clicking on the link. You’ve likely seen this if you have multiple browsers installed. This is because they have all registered for the HTTP URI.

To handle the deep link in the app, you simply need to grab the intent data string in the Activity that was opened via the click.

Uri data = this.getIntent().getData();
if (data != null && data.isHierarchical()) {
	String uri = this.getIntent().getDataString();
	Log.i("MyApp", "Deep link clicked " + uri);
}

 

From here, you’ll need to do string parsing to read the values appended to the URI scheme.

Now that you have configured your Android app for a URI scheme, you just need to add some Javascript to your website to auto trigger your app open.

Step 2: Add Javascript to Your Website

Keep in mind that the app must be installed on an Android device for use with standard deep links. If the app is not installed, the user will get an error.

As a workaround, the Javascript you add to your website that will auto trigger your app open should also include a fallback function to redirect users without your app installed to the Google Play Store.

var fallbackFunction = function() {
	window.location.replace('market://details?id=com.myapp.package');
};
var addIFrame = function() {
	var iframe = document.createElement("iframe");
	iframe.style.border = "none";
	iframe.style.width = "1px";
	iframe.style.height = "1px";
	iframe.src = 'your_uri_scheme://';
	document.body.appendChild(iframe);
};
addIFrame();
setTimeout(fallbackFunction, 250);

 

While this redirect prevents users without the app installed from getting an error message, deferred deep links provide a more seamless user experience. Deferred deep links retain the context of the link post-install and route users to that specific in-app content on first launch. This is only possible with tools like Branch. Learn more about deferred deep linking.

How Leading Apps are Increasing Installs with Android Instant Apps

You can further improve the user experience for those who don’t have your app downloaded – and increase their likelihood of installing – by incorporating Android Instant Apps. First introduced in 2016, Android Instant Apps allow users without your app installed to interact with a portion of your native app, also referred to as a “split.”

These splits are not the full version of your Android app, so you should design your user experience in a way that compels them to download the full native app as they engage with the portion of your app experience.
To learn how you can provide an optimal user experience through this Instant-Apps-to-full-app transition and preserve the context of a user’s first click through deep linking post install, read Deep Linking and Attribution for Android Instant Apps with Branch.

The Latest in Android Deep Linking
New in Android 9 Pie: App Actions

Android App Actions enable Google and Android to surface your app to users through the Google Search App and the Google Assistant. To do this, you must register your app to handle one or more user intents. Your app will then be recommended to users through Google’s catalog of common app interests, abilities, and content.

Here’s an example: An Android user searches for “Taylor Swift” in the Google Search App or Google Assistant, and the results match a list of action keywords provided by Spotify’s mobile team. An action bar then appears that includes an option to open the Taylor Swift artist page in the Spotify app.

 

New in Android 9 Pie: Android Slices

Along with Actions, Google is rolling out Android Slices. Slices provide an additional opportunity beyond Instant Apps to encourage app engagement outside of the fullscreen experience. They’re essentially UI templates that surface rich, interactive content from an app within the Google Search app and eventually the Google Assistant.

Slices are interactive and allow users to do things in apps without actually opening those apps. Back to the Taylor Swift example: Rather than a prompt to open the Spotify app, a Slice would include a small playback interface where the user could play Taylor Swift without ever opening Spotify.

You can find more information – and get notified when these features are rolled out to all Android users – on the Android Developers site.

App Actions and Android Slices offer a seamless experience from search to app, but they lack the attribution capability to measure that performance. Discover how Branch allows you to build high-quality user experiences with Android Slices that are also measurable and attributable here.

While this post provides the foundation for an Android deep linking strategy, you’ll find Android is extremely complicated and there are edge cases everywhere. Luckily, Branch handles the many edge cases and complexities of deep linking in Android OS. Branch also provides advanced analytics for clicks, opens, and down-funnel actions and conversions.

Ready to optimize your Android user experience and maximize the ROI of your deep linking strategy? You can start by joining the Branch dashboard.