简体   繁体   中英

Can we handle voice command from assistant widget?

I'm able to integrate Android widgets with 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? Can it be done by SpeechRecognizer API?

Broadly speaking, App Actions do not have a voice conversation experience. 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.

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?" and for them to just say the name.

Can I use the 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. While there, you could use SpeechRecognizer or just open the microphone to send audio somewhere. But this isn't done using the Widget itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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