[英]Send Google Assistant (Specifically the Assistant, not any other search method) a command from an Android app
[英]how to send command to Google Assistant from Android
我想通过我的应用程序中的特定命令交互来启动 Google 助理。
我试过:
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);
它显示了谷歌网络上的网络搜索结果。 这不是我想要的结果。
我也试过:
Intent intent = new Intent(Intent.ACTION_VOICE_COMMAND);
intent.putExtra(SearchManager.QUERY, "my command");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
从上面的代码中,Google Assistant 已启动并准备好接受用户语音命令。 “我的命令”不起作用。
.
上面代码的预期结果:
如果“我的命令”是“现在几点了?”,当前时间应该显示在屏幕上。
该操作应与用户使用“现在几点了?”呼叫 Google 助理时相同。
参考: 从 Android 应用程序向 Google 助理发送命令
有任何想法吗?
在Google 支持处为 Google 助理设置和管理应用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.