智能手机
利用手机提供的全部多模式功能(包括语音和视觉功能),帮助用户随时随地处理各种事务。
模态
对于配有屏幕的移动设备,您的 Action 需要支持两种模态:
请注意,在 Action 中,用户可在这些模式之间自由切换。请务必专门针对每种模态设计丰富响应。例如,使用键盘调用时,如果 SSML 中提供了声音,则不会播放声音。如果响应依赖于用户听到的声音,并且设备使用的是键盘模式,那么您的 Action 需要描述播放的声音类型。
如需检测智能手机上的屏幕和输入模式是否可用,您可以使用以下代码:
- 带有屏幕:
if (conv.screen)
- 使用语音模式:
if (conv.input.type === 'VOICE')
- 使用键盘模态:
if (conv.input.type === 'KEYBOARD')
提示和最佳做法

试试以下操作
试用此示例
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-12-02。
[null,null,["最后更新时间 (UTC):2023-12-02。"],[[["Build Actions that enable users to accomplish tasks on their mobile devices using voice and visual interactions."],["Support both voice and keyboard invocation methods, tailoring responses appropriately for each modality."],["Enhance the user experience with rich responses, push notifications, and concise conversational flows."],["Leverage deep links to seamlessly integrate your Action with other platforms like websites and apps."]]],["Actions on mobile devices should support both voice and keyboard input. Developers can detect screen availability and input modality using `conv.screen` and `conv.input.type` respectively. When using keyboard input, sounds should be described in text instead of played. Rich responses and theme customization enhance screen usage, while push notifications and deep links maintain user engagement. Prioritize quick task completion and intuitive conversational flows, considering the user is on the go.\n"]]