What's New in APL 1.9
Alexa Presentation Language (APL) 1.9 introduces new features and capabilities for APL.
Authoring tool updates
The APL authoring tool has been updated with the following improvements:
-
The Lottie converter now supports additional Lottie format features:
- Trim Paths (limited support)
- Precomps
- Dashes
- Mattes (limited support)
For details, see Import a Lottie Animation
- The authoring tool now displays Code View and GUI View tabs, to make it easier to edit your document in different modes.
- The authoring tool now includes Add Component and Delete Component buttons, to make it more clear how you add items to the document while working in the GUI view.
- The Multimodal Responses button in the developer console navigation now opens the authoring tool in a pane within the same window, instead of launching a new window or tab.
- Edit Alexa Vector Graphics (AVG) in a graphical user interface. You can change colors and path data in the interface as an alternative to editing the JSON code. For details, see Edit an AVG in the authoring tool.
Import Scalable Vector Graphics (SVG) (Beta)
You can use the APL authoring tool to convert Scalable Vector Graphics (SVG) files into AVG objects to use in your Alexa Presentation Language (APL) documents.
The SVG format is an XML-based markup language for describing vector graphics. AVG is a parameterized subset of SVG. You can display an AVG-defined graphic in your document with the VectorGraphic
component.
For details, see Import a Scalable Vector Graphic (SVG).
Viewport profile support
The responsive components and templates now support the mobile viewport profiles:
@mobileSmall
@mobileMedium
@mobileLarge
For details about viewport profiles in the alexa-viewport-profiles
package, see Alexa Viewport Profiles.
To fully support tablets that can rotate between landscape and portrait displays, configure your skill support resizing and run the Reinflate
command when the device configuration changes. For details, see the following:
- Let APL automatically resize your document
- Reinflate the document when the device characteristics change
Import the Alexa packages into your APL document
To use the latest components, templates, styles, and resources, update your APL document to import the latest versions of the packages.
Package | Version |
---|---|
|
1.5.0 |
|
1.4.0 |
|
1.4.0 |
For an overview of the components and templates, see Responsive Components and Templates.
General updates
Gestures
APL now supports a Tap
gesture. This gesture detects a deliberate tap on a component, in a manner that is more restrictive than onPress
. Use the onTap
handler to define commands to run when the system detects a tap.
Commands
- You can now animate bound properties with the
AnimateItem
command.
Data-binding context
The environment
property in the data-binding context now includes the following new properties:
disallowEditText
– True when theEditText
component is disabled.disallowDialog
– True when theSpeakItem
andSpeakList
commands are disabled
Document properties
- A change to the
environment.disallowVideo
property now runs the commands defined in theonConfigChange
handler for the document.
Work with APL versions
In your APL document, set the version
to "1.9"
.
A user can invoke your skill on older devices that do not support the latest version of APL. When working with features introduced in a specific version of APL, 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. This property returns null
for APL 1.0 and the actual version for 1.1 or later. Use this property in when
statements to create conditional blocks based on version.
For example, this renders a VectorGraphic
on a device with APL 1.1 or later, and an image for APL 1.0:
[
{
"type": "Image",
"when": "${environment.aplVersion == null}",
"width": 100,
"height": 100,
"source": "https://example.com/alternate/image/for/older/versions.jpg"
},
{
"type": "VectorGraphic",
"when": "${environment.aplVersion != null}",
"source": "lightbulb",
"width": 100,
"height": 100,
"scale": "best-fit"
}
]
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.9. 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.9"
}
}
}
},
"apiEndpoint": "https://api.amazonalexa.com",
"apiAccessToken": "eyJ..."
},
"Viewport": {}
},
"request": {}
}