elcuco
elcuco

Reputation: 9208

Voice recognition - with templates (android wear)

I am trying to develop an application for Android wear that on a button click will ask the user to speak something and send it to a webserver. I also need to have a list of pre-defined templates, similar to what Hangouts works.

What I have tried:

    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Send to server");
    startActivityForResult(intent, SPEECH_REQUEST_CODE);

This works, but I cannot supply the user a set of pre-defined templates.

Reading this - https://developer.android.com/training/wearables/notifications/voice-input.html I see that it is possible to do this in a notification... but this will not be in the front, I need this UI to be modal/blocking, so a notification is not good for my use case.

What are my options? How can I implement this?

Upvotes: 0

Views: 364

Answers (1)

Mr.Rebot
Mr.Rebot

Reputation: 6791

Unfortunately, other than Receiving Voice Input in a Notification there is no way to use voice recognition with pre-defined text responses.

Based on the documentation : Adding Voice Capabilities

Voice actions are an important part of the wearable experience. They let users carry out actions hands-free and quickly. Wear provides two types of voice actions:

System-provided

  • These voice actions are task-based and are built into the Wear platform. You filter for them in the activity that you want to start when the voice action is spoken. Examples include "Take a note" or "Set an alarm".

App-provided

  • These voice actions are app-based, and you declare them just like a launcher icon. Users say "Start " to use these voice actions and an activity that you specify starts.

Also as discussed in 24543484 and 22630600, both implemented a notification in their android to get the voice input.

Hope this helps.

Upvotes: 1

Related Questions