开发者控制台
感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

Test Launcher Integration with ADB (Optional)

After integrating your app with the Fire TV Launcher, you can use Android Debug Bridge (ADB) to test your app and ensure that it responds correctly to sign in and playback intents.

When to Use This Testing Option

Use this testing option when you have not yet completed development on your app or have not yet implemented the code to respond to Intents from the launcher (see Integrate Your App with the Fire TV Launcher). You will also need a Fire TV device to be able to test your app's launcher integration.

If you want to test launcher integration but haven't completed your app yet or at least haven't implemented the code to respond to Intents, use the Test App option. See Test Fire TV Launcher Integration with the Integration Test App.

Process Overview

Use the following high-level process to test your Fire TV launcher integration using ADB:

Step A: Install Your App to a Fire TV Device using ADB

Before you can test your app, you will need to install your app to a Fire TV device. To install your app to a Fire TV Device:

  1. Use ADB to connect the Fire TV device to your development computer. (See Connecting ADB to Your Fire TV Device.)
  2. Sideload your app onto the device for testing. (See Installing and Running Your App).

All of the adb commands on this page use the Android activity manager (am) to send Intents to your app. For more information on the syntax and options for am, see Android Debug Bridge on the Android developer website.

Step B: Test Your Sign-in Requests for your App

Sign-in requests from the Fire TV Launcher include both the request itself and a reference to the requested content, which should play immediately after the user signs in. The content reference may be a URI or a data extra name/value pair, depending on your implementation.

To test sign-in requests:

  1. On the computer that you have connected to the Fire TV device via ADB, open a terminal window so that you can access the command line.
  2. At the shell prompt, type one of the following commands:
    • If your content is specified by URI, enter:

      adb shell am start -a <signin_intent_action>  -n <signin_component> -f <signin_intent_flags> -d <content_uri>
      
    • If your content is specified by a data extra, enter:

      adb shell am start -a <signin_intent_action>  -n <signin_component> -f <signin_intent_flags> -e <data_extra_name> <content_id>
      

Command Options

The following table describes the available options for these two commands. Replace the text in the <angle brackets> with the correct values for your app:

Command Description
-a <signin_intent_action> Your sign-in Intent action, from the SIGNIN_INTENT_ACTION extra.

Example: com.yourcompany.player.SIGN_IN
-n <signin_component> The full component name of your sign-in Activity, which consists of the package and class names separated by a slash. These values are from the SIGNIN_INTENT_PACKAGE and SIGNIN_INTENT_CLASS extras, respectively.

Example: com.yourcompany.player/com.yourcompany.player.MainActivity
-f <signin_intent_flags> The Intent flags that you specified in the SIGNIN_INTENT_FLAGS extraas a decimal value and combined with the appropriate default launcher flags. By default, the launcher sends the following flags:

Intent.FLAG_ACTIVITY_NEW_TASK

Intent.FLAG_INCLUDE_STOPPED_PACKAGES

Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED

Example decimal: 270532640
-d <content_uri> URI, if the link to your content is specified by URI. Do not use the -e option if you use the -d option.
-e <data_extra_name>
<content_id>
If the link to your content is specified in a way other than a URI, this is the key/value pair for that content. The key is from the DATA_EXTRA_NAME extra. Do not use the -d option if you use the -e option.

Examples

The following example shows the command that you might type for a sign-in Intent if your content is specified by URI:

adb shell am start -a com.yourcompany.player.SIGN_IN  -n com.yourcompany.player/com.yourcompany.player.MainActivity -f 270532640 -d myplayer://content/12345`

The following command shows the command that you might type for a sign-in Intent if your content is specified in some way other than by URI:

adb shell am start -a com.yourcompany.player.SIGN_IN  -n com.yourcompany.player/com.yourcompany.player.MainActivity -f 270532640 -e content_id 12345`

Step C: Test Playback Requests for Your App

As with sign-in requests, playback requests use the data you supply to the launcher during the capability exchange. Playback requests include a content reference, which may either be a URI or a data extra name/value pair, depending on your implementation. To playback requests:

  1. On the computer that you have connected to the Fire TV device via ADB, open a terminal window so that you can access the command line.
  2. At the shell prompt, type one of the following commands:
    • If your content is specified by URI, enter the following:

      adb shell am start -a <playback_intent_action>  -n <playback_component> -f <playback_intent_flags> -d <content_uri>
      
    • If your content is specified by a data extra key/value pair, enter the following:

      adb shell am start -a <playback_intent_action>  -n <playback_component> -f <playback_intent_flags> -e <data_extra_name> <content_id>`
      

Command Options

The following table describes the available options for these two commands. Replace the text in the <angle brackets> with the correct values for your app:

Command Description
-a <play_intent_action> Your play Intent action, from the PLAY_INTENT_ACTION extra.

Example: android.intent.action.VIEW
-n <play_component> The full component name of your play Activity, which consists of the package and class names separated by a slash. These values are from the PLAY_INTENT_PACKAGE and PLAY_INTENT_CLASS extras, respectively.

Example: com.yourcompany.player/com.yourcompany.player.PlayActivity
-f <play_intent_flags> The Intent flags that you specified in the PLAY_INTENT_FLAGS extras a decimal value and combined with the appropriate default launcher flags. By default, the launcher sends the following flags:

Intent.FLAG_ACTIVITY_NEW_TASK

Intent.FLAG_INCLUDE_STOPPED_PACKAGES

Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED

Example decimal: 270532640
-d <content_uri> URI, if the link to your content is specified by URI. Do not use the -e option if you use the -d option.
-e <data_extra_name>
<content_id>
If the link to your content is specified in a way other than a URI, this is the key/value pair for that content. The key is from the DATA_EXTRA_NAME extra. Do not use the -d option if you use the -e option.

Examples

The following example shows the command that you might type for a playback Intent if your content is specified by URI:

adb shell am start -a com.yourcompany.player.PLAY  -n com.yourcompany.player/com.yourcompany.player.MainActivity -f 270532640 -d myplayer://content/12345

The following command shows the command that you might type for a playback Intent if your content is specified in some way other than by URI:

adb shell am start -a com.yourcompany.player.PLAY  -n com.yourcompany.player/com.yourcompany.player.MainActivity -f 270532640 -e content_id 12345`