Vielen Dank für deinen Besuch. Diese Seite ist nur in Englisch verfügbar.

Changes Introduced in APL Version 1.1

Alexa Presentation Language 1.1 introduces new features and capabilities for APL.

Work with APL versions

In your APL document, set the version to "1.1".

A user can invoke your skill on older devices that do not support the latest version of APL. When working with 1.1-specific features, provide an alternative experience for devices running earlier versions of APL. The environment.aplVersion property in the data-binding context returns the version of APL on the device. Use this property in when statements to create conditional blocks based on version. For example:

{
  "type": "VectorGraphic",
  "when": "${environment.aplVersion == '1.1'}",
  "source": "iconWifi3",
  "width": 100,
  "height": 100,
  "scale": "best-fit"
},
{
  "type": "Text",
  "when": "${environment.aplVersion == null}",
  "source": "https://example.com/alternate/image/for/older/versions.jpg"
}

The APL version is also available in requests sent to your skill, in:

context.System.device.supportedInterfaces.['Alexa.Presentation.APL'].runtime.maxVersion

This example shows a request from a device with 1.1. Note that the session, request, and viewport properties are omitted for brevity.

{
  "version": "1.0",
  "session": {},
  "context": {
    "System": {
      "application": {
        "applicationId": "amzn1.ask.skill.1"
      },
      "user": {
        "userId": "amzn1.ask.account.1"
      },
      "device": {
        "deviceId": "amzn1.ask.device.1",
        "supportedInterfaces": {
          "Alexa.Presentation.APL": {
            "runtime": {
              "maxVersion": "1.1"
            }
          }
        }
      },
      "apiEndpoint": "https://api.amazonalexa.com",
      "apiAccessToken": "eyJ..."
    },
    "Viewport": {}
  },
  "request": {}
}

Vector graphics support

APL now supports Alexa vector graphics, a subset of the Scalable Vector Graphics standard. See these updates:

Animation support

APL now supports animation. You can animate the position, scale, rotation, or opacity of any APL component or layout. See the AnimateItem Command.

User-defined commands

You can define and name custom commands in your APL document or package. These commands can take parameters and then call the standard APL commands.

Alexa Design System for APL

Packages for layouts, styles, and viewport profiles are now grouped within the Alexa Design System for APL.

New responsive components and templates

APL 1.1 introduces several new responsive components and templates as part of the Alexa Design System for APL (previously referred to as "Alexa layouts"). When you use these in your APL documents, you do not need to create the conditional logic to handle different screen sizes and shapes yourself.

To use the new components and templates, import the alexa-layouts package into your document. Be sure to specify 1.1.0 for the version:

{
  "import": [
    {
      "name": "alexa-layouts",
      "version": "1.1.0"
    }
  ]
}

For an overview of the components and templates, see Responsive Components and Templates.

For details about the responsive components, see:

For details about the responsive templates, see:

For more about building responsive APL documents, see Build Responsive APL Documents

Alexa header changes

APL 1.1 adds the following new properties for AlexaHeader:

  • headerBackButtonAccessibilityLabel
  • headerBackButtonCommand
  • headerDivider
  • theme

Note that the headerNavigationAction parameter has been removed from the 1.1.0 version of AlexaHeader. Use headerBackButtonCommand to specify the command to run when the user selects the back button.

To use this updated version, be sure to specify 1.1.0 for the version when you import the alexa-layouts package.

APL 1.1 introduces the following new properties for AlexaFooter:

  • theme

To use this updated layout, be sure to specify 1.1.0 for the version when you import the alexa-layouts package.

Other APL Updates

Commands

New commands:

New properties for Sequential command:

  • catch
  • finally

Document

New top-level properties on APL Document:

  • commands
  • graphics
  • onMount
  • settings

Components

All components now support the following new properties:

  • accessibilityLabel
  • checked
  • disabled
  • display
  • onMount
  • transform

Components also now support the karaokeTarget state, which can be used to control the color of text being spoken. See Styles.

Pager:

  • The height and width of the Pager component default to 100dp if not specified. The height and width of a Pager must be either an absolute or relative dimension. You cannot use auto. The height and width of the children of a Pager are fixed at "100%".
  • The default for the navigation property is wrap.

Video

Data-binding context

New environment properties are available in the data-binding context:

  • allowOpenURL
  • animation
  • aplVersion
  • disallowVideo

The viewport object now includes the mode property.

Transformers

  • The ssmlToSpeech transformer now accepts only valid SSML text as input. The SSML must be wrapped in <speak> tags.
  • A new textToSpeech transformer converts plain text into speech.

Both transformers work in the same way. Bind the output of the transformer to the speech property of the component. See Transformers.