Alexa-AVS-Android

Alexa Voice Service (AVS) is integrated for answering questions by Alexa after handwriting questions. The input of the question is to use the handwriting recognition input method. Use Android TextToSpeech to convert text to speech. Use HttpURLConnection to communicate with Alexa to get the voice of the answer.

Alexa Voice Service (AVS) 整合用於手寫問題後由 Alexa 回答問題的答案。問題的輸入是使用手寫辨識輸入法,使用 Android TextToSpeech 把文字轉換為語音,使用 HttpURLConnection 與 Alexa 進行溝通得到答案的語音。

(本項目為測試用,並沒有優化 Source code)

Technology

- Handwriting IME
- TextToSpeech
- NanoHTTPD
- Alexa Voice Service (AVS)

Run Environment

- Android 9

Permission - AndroidManifest.xml

Need to open Android Apps Setting storage device permissions.

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

How to get the "Client ID" and "Client secret" required by Apps?

  • You need to set up a virtual drive on the AVS website.

Alexa Voice Service (AVS) Developer Console

  • How to setting virtual device?
  1. You need to apply for an AVS account. URL
  2. Enter the AVS Developer Console. URL
  3. Products -> "MANAGE YOUR PRODUCTS".

  1. click "ADD NEW PRODUCT" button. URL

  1. Product information.

    • Input Product name and Product ID. ex. test_device (Can be the same)
    • Please select your product type. -> Application with Alexa built-in

    • Product category -> Mobile Apps
    • Brief product description -> application
    • How will end users invoke Alexa with your product? -> Touch-initiated

    • Is this a children’s product or is it otherwise directed to children younger than 13 years old? -> Select No
    • click Next button.

  2. Select a Security Profile or Create a new Security Profile

  1. Platform information -> Web
  2. Allowed origins -> Input the text "http://localhost:9745/"
  3. Allowed return URLs -> Input the text "http://localhost:9745/authresponse"
  4. Click "FINISH" button.
  5. Copy "Client ID" and "Client secret" into the APP. Replace with your content.

  • Amazon changed the layout of Web content in the past.

Reference

AlexaNotificationCurl
Alexa Voice Command Example
Alexa Voice Service (AVS) with cURL
HttpURLConnection