Developer Console
Merci de votre visite. Cette page est disponible en anglais uniquement.

Step 5: Report Your App's Static Capabilities (VSK Fire TV)

With the static capabilities integration, all content is searchable and playable for free, with no user authentication needed. As such, there's no need to dynamically report your capabilities based on a user login state, and you can indicate your app's capabilities directly in your app manifest. The VSK Agent will detect those capabilities as referenced in your manifest automatically.

Sample App Notes

The sample app already reports static capabilities, so you do not need to do any coding in this step. In the sample app, see the AndroidManifest.xml and raw/static_capabilities files for details about how the static capabilities are declared.

Declare Static Capabilities

The VSK Agent is an on-device routing agent on Fire TV that sends VSK directives to your application (through intents). The VSK Agent scans your app's AndroidManifest.xml for static capabilities to see your app supports. Declare your app's static capabilities as follows:

  1. Open your AndroidManifest.xml file and add the following resource inside the application element.

    <meta-data android:name="com.amazon.alexa.vsk_app_agent_api.capabilities" android:resource="@raw/static_capabilities" />
    
  2. This previous code references a resource at @raw/static_capabilities that lists details about the capabilities your app supports. Add this file (called static_capabilities — no file extension) inside app/res/raw in your project.

    This static_capabilities file lists capabilities that your app always supports. This file will be scanned by VSK Agent on app install or app update. This means the user can control your app by voice without opening it for the first time.

    Sample App Notes

    The sample app also shows other capabilities files inside the raw folder. You can disregard these other capabilities files, as they are used only for the dynamic capabilities integration.
  3. In the static_capabilities file, list the capabilities your app supports.

    The contents of static_capabilities must be a JSON object containing a single capabilities array, with each object in the array listing a different capability. See Supported Capabilities with App-only Integration for a list of all possible capabilities you can add in the JSON file.

    For example, to declare support for the RemoteVideoPlayer capabilities, including both SearchAndPlay and SearchAndDisplayResults directives that this interface sends, add the following code to your static_capabilities file:

    {
      "capabilities": [
        {
          "type": "AlexaInterface",
          "interface": "Alexa.RemoteVideoPlayer",
          "version": "3.1",
          "configurations": {
            "operations": [
              "SearchAndDisplayResults",
              "SearchAndPlay"
            ],
            "catalogs": [
              {
                "type": "VIDEO_INGESTION_IDENTIFIER",
                "sourceId": "<INSERT PARTNER ID>"
              }]
          }
        }
      ]
    }
    

    To declare support for both RemoteVideoPlayer and PlaybackController (not recommended), add the capability as another object in the capabilities array:

    {
      "capabilities": [
        {
          "type": "AlexaInterface",
          "interface": "Alexa.PlaybackController",
          "version": "3",
          "supportedOperations" : ["Play", "Pause", "Stop"]
        },
        {
          "type": "AlexaInterface",
          "interface": "Alexa.RemoteVideoPlayer",
          "version": "3.1",
          "configurations": {
            "operations": [
              "SearchAndPlay",
              "SearchAndDisplayResults"
            ],
            "catalogs": [
              {
                "type": "VIDEO_INGESTION_IDENTIFIER",
                "sourceId": "<INSERT PARTNER ID>"
              }]
          }
        }
      ]
    }
    

    In the code above, the app now supports Play, Pause, and Stop directives from the Alexa.PlaybackController too.

    Note that if you indicate capabilities like this in your static_capabilities file, your app must be able to handle these directives. If your app doesn't support these directives, don't list the capabilities here. Alexa sends you only the directives that your app declares it supports. For example, if you declare PlaybackController, you'll get directives for this interface that you're expected to handle; if not, you won't.

    Sample App Notes

    See the static_capabilities file (in app/res/raw) in the sample app for an example. In the sample app, both SearchAndPlay and SearchAndDisplayResults operations are supported (these are part of the RemoteVideoPlayer interface), and Play, Pause, Stop operations are supported (part of the PlaybackController interface). The catalog specified is ontv; however, the actual catalog used for this sample app is handled through a special backend mapping of the com.example.vskfiretv package prefix and the IMDb catalog — it doesn't matter what value you use (e.g., ontv or something else) for the catalog name in the sample app.
  4. In the catalogs property, update the value for the sourceId with your Partner ID.

    Your Partner ID is the same value you report to Fire TV launcher during the catalog integration with the Fire TV launcher (see Universal Search and Browse). It's also the Partner field in your CDF file (which you submitted during catalog integration.) Your Amazon representative can provide this ID if you need it. See the RemoteVideoPlayer Capabilities section in "Supported Capabilities" for more details about the catalogs property.

Next Steps

Go to the next step: Step 6: Report Your App's Dynamic Capabilities.