How can I get Alexa working on my iOS app?

断了今生、忘了曾经 提交于 2020-01-13 04:54:06

问题


I have been checking out the Alexa Skills kit the past few days. I have also been poring through the documentations for both the Skills kit and the Voice Service. I am just having a little hiccup trying to understand the flow. I have implemented one of amazon's sample skills (favourite colour sample) in the developer console and also wrote a sample lambda function to handle the type of response that will be delivered. Its working on the test simulator and what left is basically getting lambda running through my ios app. However I have the impression that I don't have to use the voice service. Am I wrong? I am quite confused, it would be awesome if anybody who has some more clarity could shed some light on the matter. If I get lambda working also, I think it will accept requests that are in a particular format. Where do I have to send the encoded audio to get a json response to send to the skills kit? To the Alexa Voice Service?

Also I am authenticating my app using cognito and dynamo db. If I were to use Alexa Voice Service, then it is mentioned that the user will have to also login to amazon. So do I still have to work with the login with amazon sdk? Or is there a workaround?


回答1:


Based on Amazon documentation there are two ways to interact with Alexa:

Sounds like you want to implement the app thru the Companion method.

As far as the JSON goes, i am currently resolving that issue now, (will post answer once I have it resolved).

Basically you have to use AVFoundation to capture audio from iPhone and send 2 https messages to Alexa (One message with JSON Body & the second message with audio captured as body.) Bases on Documentation

  1. Companion App (You have a device (such as a smart speaker) that you want to add Alexa to. So, you build in support for AVS. Great! Now you need a way to authorize it and associate it with the user's account. This is the "companion app" approach. The companion app connects to your smart product and allows the user to login and authorize the speaker to use Alexa and connect to their Amazon account.)

    Mobile OR Website

  2. AVS App (You don't have a device you need to authorize - instead you want to speak to Alexa from within your Android/Iphone application.)

    Android or Iphone




回答2:


You can find a swift example on github on how to implement a iOS AVS client

https://github.com/chintan1891/iOS-Alexa



来源:https://stackoverflow.com/questions/35915178/how-can-i-get-alexa-working-on-my-ios-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!