We are excited to announce version 2 of the Alexa Skills Kit (ASK) Software Development Kit (SDK) for Java. The updated SDK includes new features that help you build skills faster and reduce complexity in your code.
The ASK SDK v2 for Java helps you get a skill up and running quickly, letting you use built-in functions for common tasks rather than writing them yourself. The SDK includes interfaces to simplify requests and responses, manage dialog, display content on Echo Show and Echo Spot, stream audio and video, and more. To get started quickly building a skill using Java, you can use the “Hello, World” guide and other sample code included in the SDK.
Several features in the updated SDK help you streamline event handling. Using Request Handlers, you can easily group request processing logic that applies to one or more types of skill requests. Handlers give you complete control of when a particular handler should be invoked. You can also use Request and Response Interceptors to centrally register common logic that applies to multiple request processing workflows without duplicating code. For example, you can create a request interceptor that initializes skill attributes for new sessions before request handlers are executed. Finally, you can use Exception Handlers to gracefully respond to unexpected errors and identify non-obvious errors in your code, such as missing handlers for infrequent events.
You can store and retrieve data for your skill using the Attributes Manager, and use this data to control what happens next. For example, you could store the customer’s level in a game or spot in a story, and use this to determine what happens next. Attributes take the form of key and value pairs, and can be maintained at the level of the current request or the current skill session. You can even maintain attributes across multiple skill sessions by configuring the Persistence Adapter to use the external database of your choice. The SDK includes a default persistence adapter for Amazon DynamoDB.
The SDK makes responses and Alexa service calls easy. You can build a range of response types for Echo, Echo Show, and Echo Spot using the Response Builder, including simple speech, audio playback, graphical display interaction, and more. You can use Alexa Service Clients to call the Household Lists service, the Device Address service, and the Directives service – the service clients automatically inject endpoint and authentication token information for you.
Download the ASK SDK v2 for Java from the alexa-skills-kit-sdk-for-java repository on GitHub. Visit the SDK wiki page in GitHub to find everything you’ll need to get started, from a “Hello, world” sample to the complete technical documentation.