Android Wear Custom Voice Actions

前端 未结 1 439
长发绾君心
长发绾君心 2020-12-17 20:16

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/t

1条回答
  •  囚心锁ツ
    2020-12-17 20:50

    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.

    0 讨论(0)
提交回复
热议问题