简体   繁体   English

我们可以处理来自助手小部件的语音命令吗?

[英]Can we handle voice command from assistant widget?

I'm able to integrate Android widgets with Google Assistant .我能够将 Android 小部件与Google Assistant集成。 And want to have some voice command experience.并希望有一些语音命令经验。

For example the CREATE_CALL intent, if user is trying to call Alice by saying call Alice with some app , and if there are 2 Alice in my app, is it possible for me to response with a widget showing 2 Alice, and asking user by voice, and user can choose which one to actually call, all by voice?例如CREATE_CALL意图,如果用户试图通过调用 Alice 来call Alice with some app ,并且用户可以选择实际呼叫哪一个,全部通过语音? Can it be done by SpeechRecognizer API? SpeechRecognizer API 能做到吗?

Broadly speaking, App Actions do not have a voice conversation experience.从广义上讲,App Actions 没有语音对话体验。 There are some tricks you can pull that might head in that direction, but they are largely outside of the App Action Widget experience itself.您可以采取一些技巧,可能会朝着这个方向发展,但它们在很大程度上超出了 App Action Widget 体验本身。

Can I respond with a widget showing that there are multiple matches?我可以回复一个显示有多个匹配项的小部件吗?

Yes, you can send back a Control Widget that might allow them to choose which user they mean.是的,您可以发回一个控件小部件,它可能允许他们选择他们所指的用户。

Can they speak which user?他们能说哪个用户吗?

Probably not in the way you're thinking.可能不是你想的那样。 To use your example, they can re-invoke the CREATE_CALL BII using any of the phrases, but you can't prompt them with "Who did you mean, exactly?"使用您的示例,他们可以使用任何短语重新调用CREATE_CALL BII,但您不能用“您的意思是什么?”提示他们。 and for them to just say the name.让他们说出名字。

Can I use the SpeechRecognizer API?我可以使用SpeechRecognizer API 吗?

Not as part of a widget.不作为小部件的一部分。

Widgets get embedded in the conversation with the Assistant.小部件嵌入到与助手的对话中。

In theory (and this is on my list to eventually test and figure out), you should be able to deep link to an Android Intent in cases such as this and open a view.理论上(这是我最终测试和弄清楚的清单),在这种情况下,您应该能够深度链接到 Android Intent 并打开视图。 While there, you could use SpeechRecognizer or just open the microphone to send audio somewhere.在那里,您可以使用SpeechRecognizer或打开麦克风在某处发送音频。 But this isn't done using the Widget itself.但这不是使用 Widget 本身完成的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM