Alexa Skill: how to detect display in Python?

241 Views Asked by At

I've added APL support to my skill but now I can't understand how to check if the device has a display and therefore supports APL. Seems pretty easy in Node.js but Python (3.7) has been driving me crazy. I have tried the approach mentioned here, but I'm using a class based lambda function and I'm not sure how to use that code. I've also tried this:

if context.System.device.supportedInterfaces.Display is None

I've checked and double checked the documentation and all the sample skills, but apparently they forgot to check for APL support in their sample skill as well. I'm really at a loss here. Can someone point me in the right direction?

2

There are 2 best solutions below

0
On

I've been dealing with this myself to develop my own skill and I think I've achieved this by checking if handler_input.request_envelope.context.system.device.supported_interfaces.display is None.

This way, system exists in this context. I hope this may help you!

0
On

You will want to look for the existence of "Alexa.Presentation.APL" instead of display inside the context.System.device.supportedInterfaces which is an array. Display is for the old display templates rather than APL.

Otherwise, the code in the linked post should work.