【问题标题】:how to send command to Google Assistant from Android如何从 Android 向 Google Assistant 发送命令
【发布时间】:2020-01-15 07:03:52
【问题描述】:

我想通过我的应用中的特定命令交互来启动 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 Assistant 时的操作相同。

推荐人:Sending commands to Google Assistant from Android app

有什么想法吗?

【问题讨论】:

    标签: android google-assistant-sdk


    【解决方案1】:

    通过Google support为 Google 助理设置和管理应用

    【讨论】:

      猜你喜欢
      • 2018-03-31
      • 2018-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-23
      • 2016-03-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多