About Deep Linking with Featured Content
Deep links take users from the Fire TV OS into a specific destination within an app on Fire TV. Within the context of featured content, deep links take users to the content being promoted. For example, if a merchandising placement for “ACME Media” promotes a Football Playoff game, any ACME customers who click on the Football Playoff placement will be taken directly to the page for that Football Playoff game within the app, where they can watch the game or record it for future viewing. If the customer has not previously downloaded your app on their Fire TV, the campaign will take users to your app details page, where the user can choose to download and open your app. After users download and open your app, they will be taken directly to the content promoted in the campaign. Overall, deep linking gives more immediacy and continuity to the featured content displayed on Fire TV because the deep link provides a seamless transition from the content displayed in the campaign to the destination in the app for that same content.Prerequisites
You will need to use Android Studio and adb to generate the encoded deep link intent. adb is installed by default with Android Studio. If you’re new to adb and need more info on setting it up, see Android Debug Bridge (ADB) in the Android docs.Generate an Encoded Deep Link Intent for your Content
You need to generate out an encoded deep link intent by customizing some code in a simple app. Your customizations for the deep link intent will depend on the parameters used in your adb command. To generate an encoded deep link intent to your content, see the following two sections.Step 1: Create adb Command That Deep Links to your Media
If you already know the deep link intent values for your media, you can proceed directly to the next section, Step 2: Encode your Deep Link Intent Using Android Studio. However, you should still configure an adb command to test that the values surface your media, because there’s no other way to test the deep link intent before submitting it. To create an adb command to your media:-
Create an adb command that provides your deep link intent. For example, your adb command to play the media might look like this:
In Android, deep links can be structured in different ways, and how each app chooses to structure deep links is known only to the app. You might use different parameters and components in your command. Your adb command will typically use
adb shell am startand several parameters:-a(action) - specifies the intent action-n(package + component) - specifies the package and component name-d(data_uri) - specifies the intent data URI
- Connect adb to Fire TV and run your adb command. (For help connecting, see Connect to Fire TV Through ADB.)
- Make sure that the right media appears on your Fire TV. (If the adb command fails, then the encoded deep link that you generate in the next section will also fail.)
Step 2: Encode your Deep Link Intent Using Android Studio
You need to convert your adb command (deep link intent) to an encoded string. To do this, you will download a simple Android app. The app has an a class with various methods that you will customize as needed. In the app, you will take the parameters from your adb command and store them in an intent object calledamazonIntent.
After adding all your adb parameters into amazonIntent, the toURI method converts this amazonIntent object into an encoded URI string. The encoded URI string contains all the information from your adb command (the action, package, component, flags, extra, etc.). When you run the Android app, the encoded URI string gets printed in the Logcat console.
To generate your encoded deep link intent in Android Studio:
- Download this simple Android app: toURI. After downloading it, unzip it.
- Open Android Studio and open the toURI app. (When you open the app, Android Studio will automatically update the location of the Android SDK.)
-
In
MainActivity.javafile (inside app/java/com/example/touri), customize the code based on the description in the comments. There are six sections to customize. -
After you finish customizing the code, click the Run App button
and run the application on any device (any emulator or connected Fire TV device, etc.).
-
Open Logcat and filter on the word “amazon”. The value appears after “amazon_intent=:”.
The value will be an encoded string such as this:

Filtering for amazon to get the encoded deep link intent
- Copy the value and send this to your Amazon representative.
Handling Scenarios Where Deep Links Are Destroyed
In most cases, users will click the campaign and the media from your app will open and play. However, you should handle scenarios where the deep link might be destroyed before the user opens the app, or cases where (for whatever reason) the media in the deep link isn’t available. In those cases, you might decide to take users to your homepage instead. The following diagram shows scenarios where the deep link might be destroyed.Workflow for deep links

