question

newuser-c630592e-475a-4c82-82ea-bc47e4dff788 avatar image

Alexa Skill with Maven for Echo Show

Hey Guys,

i haven't found a sample for the Maven project yet so i tried it by myself.

I did the following :

// Create the plain text output. PlainTextOutputSpeech speech = new PlainTextOutputSpeech(); speech.setText(speechText); // RenderTemplateDirective t = new RenderTemplateDirective(); BodyTemplate1 bodyTemplate1 = new BodyTemplate1(); TextContent textContent = new TextContent(); PlainText text = new PlainText(); text.setText("hallo"); textContent.setPrimaryText(text); bodyTemplate1.setTextContent(textContent); bodyTemplate1.setToken("test"); bodyTemplate1.setBackButtonBehavior(BackButtonBehavior.HIDDEN); bodyTemplate1.setTitle("titel"); com.amazon.speech.speechlet.interfaces.display.element.Image backgroundImage = new com.amazon.speech.speechlet.interfaces.display.element.Image(); backgroundImage.setContentDescription(""); backgroundImage.setLargeSourceUrl(""); backgroundImage.setSmallSourceUrl(""); bodyTemplate1.setBackgroundImage(backgroundImage); t.setTemplate(bodyTemplate1); SpeechletResponse res = new SpeechletResponse(); List<Directive> directives = new ArrayList<Directive>(); directives.add(t); directives.add(t); res.setDirectives(directives); if (!directives.isEmpty()) System.out.println("leeeeeeer"); if (!res.getDirectives().isEmpty()) System.out.println("zweites leeeer"); // Create reprompt // Reprompt reprompt = new Reprompt(); // reprompt.setOutputSpeech(speech); Image image = new Image(); image.setLargeImageUrl(""); image.setSmallImageUrl(""); StandardCard scard = new StandardCard(); scard.setTitle(""); scard.setText(""); scard.setImage(image); Reprompt reprompt = new Reprompt(); PlainTextOutputSpeech respeech = new PlainTextOutputSpeech(); respeech.setText(""); reprompt.setOutputSpeech(respeech); return res.newAskResponse(speech, reprompt, scard);

Could you add a sample for this?

How should i response this to the user?

The only possible Response capabilities i know are TellResponse and Askresponse.

And they only have a card and a outputspeech as value.

But if i do this now the awnser is

{ "version": "1.0", "response": { "shouldEndSession": false, "outputSpeech": { "type": "PlainText", "text": "Version 0.1.18" }, "card": { "type": "Standard", "title": "", "text": "", "image": { "smallImageUrl": "", "largeImageUrl": "" } }, "reprompt": { "outputSpeech": { "type": "PlainText", "text": "" } } }, "sessionAttributes": {} }

so i dont get any echo show outupt.

helpechoresponseecho showjava
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

TommyS avatar image
TommyS answered

Hi, I think what you want to do is not yet supported by the Java Alexa Skills Kit SDK.

So if you want to do it with Java, you either have to check out the sdk code from git hub (at https://github.com/amzn/alexa-skills-kit-java) and change it in the sdk and build your own version of it, or you do not use the sdk and just work with JSON data in a standard servlet.

The problem is, that there is no roadmap by when a certain update of the api gets added to the java sdk.

Regards,

Thomas

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.