APL Viewport Characteristics in the Skill Lambda

A skill request includes viewport characteristics when a skill lambda or skill service is invoked by Alexa and the Alexa-enabled device supports APL. The availability of these characteristics in the skill lambda means that skills can generate customized responses, including text-to-speech (TTS) responses, depending upon a device's visual characteristics. See also: Viewport property.

This sample skill request shows the viewport characteristics available to the skill lambda in the Viewport objects.

{
    "version": "1.0",
    "session": { 
        ...
    },
    "context": {
        "AudioPlayer": {
            "playerActivity": "IDLE"
        },
        "Display": {
            "token": "listToken"
        },
        "Viewport": {
           "experiences": [
               {
                   "canRotate": true,
                   "canResize": true
               },
               {
                   "canRotate": false,
                   "canResize": false
               }
           ],
           "shape": "RECTANGLE", // also supported: ROUND
           "pixelWidth": 1024, // maximum viewport value
           "pixelHeight": 600, // maximum viewport value
           "dpi": 160,
           "currentPixelWidth": 640, // viewport width that is currently in use
           "currentPixelHeight": 500, // viewport height that is currently in use
           "touch": [ "SINGLE" ],
           "keyboard": [ "DIRECTION" ]
        },
        "System": {
            ...
        }
    },
    "request": {
        ...
    }
}