Ti ringraziamo per la visita. Questa pagina è per il momento disponibile solo in inglese.

Changes Introduced in APL Version 1.2

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

General updates

All components now have new properties for displaying shadow effects:

All components now have new properties for cursor handlers:

The set of filters now includes a Noise you can use to add generated noise to images. Use this with the Image component.

APL now provides support for keyboards and keyboard events. You can define handlers for KeyUp and KeyDown events at both the component and document level. See Keyboard.

Components that can respond to touch, cursor, and keyboard events now have additional actionable component properties such as onFocus and handleKeyDown. The following components are actionable:

  • Pager
  • ScrollView
  • Sequence
  • TouchWrapper

See Actionable Component Properties for the new properties available on these components.

Work with APL versions

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

A user can invoke your skill on older devices that do not support the latest version of APL. When working with 1.2-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.2' || 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.2. 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.2"
            }
          }
        }
      },
      "apiEndpoint": "https://api.amazonalexa.com",
      "apiAccessToken": "eyJ..."
    },
    "Viewport": {}
  },
  "request": {}
}

Previous APL versions