對話動作已於 2023 年 6 月 13 日淘汰。詳情請參閱「
對話動作已淘汰」。
智慧型手機
讓使用者隨時隨地輕鬆處理工作,可以使用手機上的完整多模組功能,包括語音和影像內容。
形式
使用配備螢幕的行動裝置時,您的動作必須支援兩種模式:
請注意,使用者在「動作」中的這些形態可以自由移動。請務必專門為每個模式設計豐富的回應。例如,使用鍵盤叫用時,如果 SSML 中提供任何音效,系統就不會播放音效。如果回應需要使用者聽到聲音,且裝置採用鍵盤形態,您的動作就需要描述要播放的音效。
如要偵測智慧型手機的螢幕可用性和輸入形態,您可以使用以下程式碼:
- 有螢幕:
if (conv.screen)
- 使用語態:
if (conv.input.type === 'VOICE')
- 使用鍵盤形態:
if (conv.input.type === 'KEYBOARD')
提示和最佳做法

試試下列動作
試用此範例
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2023-12-02 (世界標準時間)。
[null,null,["上次更新時間: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"]]