Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
668 views
in Technique[技术] by (71.8m points)

speech recognition - Android Wear Custom Voice Actions

I'm making an app that will work with Android Wear, And I wanted to implement a command into Google's "Ok Google" option. I saw this page: http://developer.android.com/training/wearables/apps/voice.html

But it's related only to apps that include Activities in the Android Wear.

I wanted to ask:

  1. Can I add custom commands? I mean, those who does not start with the word "Start"?
  2. Can I add commands that will do another thing than just opening the app? Like running a method?

If it's not the place to ask this, can you give me an email/link to Google Developers help/support? thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For apps that run on the Android Wear Device:

  1. No, the list of system-provided voice actions is fixed (and listed here). You can set your application to be able to respond to them (for example, to take a note), but you cannot add new ones.
  2. Yes. When already inside your app, you you can use startActivityForResult() using the ACTION_RECOGNIZE_SPEECH to get voice input. You could then use the returned string to execute whatever you want.

Meanwhile, if you're just displaying notifications from an Android app running in a handheld, then you cannot presently have voice actions at all (at least in a literal sense). What you may have, though, is a notification action that requests voice input. That input will then be passed as an extra in the Intent that is delivered to the app in the handheld.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...