简体   繁体   English

如何从 Android 向 Google Assistant 发送命令

[英]how to send command to Google Assistant from Android

I want to start Google Assistant with a specific command interaction from my app.我想通过我的应用程序中的特定命令交互来启动 Google 助理。

I tried:我试过:

Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
intent.setClassName("com.google.android.googlequicksearchbox", "com.google.android.googlequicksearchbox.SearchActivity");
intent.putExtra(SearchManager.QUERY, "my command");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);

It shows a web search result on google web.它显示了谷歌网络上的网络搜索结果。 It is not the result what I want.这不是我想要的结果。

And I also tried:我也试过:

Intent intent = new Intent(Intent.ACTION_VOICE_COMMAND);
intent.putExtra(SearchManager.QUERY, "my command");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);

From the above code, Google Assistant is started and ready for user voice command.从上面的代码中,Google Assistant 已启动并准备好接受用户语音命令。 "my command" dose not work. “我的命令”不起作用。

. .

Expected result with the above code:上面代码的预期结果:

If 'my command' is "what time is it now?", the current time should be shown on the screen.如果“我的命令”是“现在几点了?”,当前时间应该显示在屏幕上。

The action should be same as when user call Google Assistant with "what time is it now?".该操作应与用户使用“现在几点了?”呼叫 Google 助理时相同。

Referred: Sending commands to Google Assistant from Android app参考: 从 Android 应用程序向 Google 助理发送命令

Any ideas?有任何想法吗?

Google 支持处为 Google 助理设置和管理应用

暂无
暂无

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

相关问题 从Android应用程序向Google助手(特别是助手,而不是任何其他搜索方法)发送命令 - Send Google Assistant (Specifically the Assistant, not any other search method) a command from an Android app 如何从Android应用程序向Google Assistant发送文本查询 - How to send a text query to Google Assistant from Android app 通过语音命令(例如Google助手)启动android应用 - Lanch android app from voice command like google assistant 谷歌助理如何直接从谷歌助理应用程序发送个人 whatsapp 消息? 是 Google Assistant 为 whatsapp 制作了 UI? - How does google assistant send personal whatsapp messages directly from Google Assistant app? Is it Google Assistant who made the UI for whatsapp? 从我的应用程序向 Google 助理发送语音或文本命令(Hey Google) - Send Voice or Text Command From My App To Google Assistant (Hey Google) 使用 Android 应用程序运行 Google Assistant 命令 - Run Google Assistant Command with an Android App Android应用程序中的Google Assistant命令触发操作 - Google Assistant command triggering action in Android application 如何从 android 手机谷歌助手控制 Android 应用程序操作 - How to control Android app action from android phone google assistant 如何使用android通过语音命令(谷歌助手)在我的android应用程序中打开指定的活动 - How to open a specified activity inside my android application through voice command( google assistant) using android 从Android应用程序向Google Assistant发送命令 - Sending commands to Google Assistant from Android app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM