android - 向 Android Assistant 添加内容

标签 android json assistant google-assist-api

您好,我正在开发一个处理产品的应用程序,我想使用 Android 助手改善用户体验。

我阅读了 Google 的文档并首先尝试使用以下代码:

@Override
public void onProvideAssistContent(AssistContent assistContent) {
super.onProvideAssistContent(assistContent);

 String structuredJson = new JSONObject()
   .put("@type", "MusicRecording")
   .put("@id", "https://example.com/music/recording")
   .put("name", "Album Title")
   .toString();
 assistContent.setStructuredData(structuredJson);
}

该代码被调用,但没有添加到 Google 助手抓取当前 View 的正常体验中。 我还尝试使用产品架构 ( schema.org ) (使用@product、@brand、@review ...),因为我认为问题是 json 对象在谷歌搜索中没有给出任何结果。 但是这个新的 json 什么也没有出现。

当我认为问题在于 json 在 Google 搜索中没有定论或者我忘记做更多事情时,我错了吗?

谢谢

最佳答案

关于 Google Assistant,因为它是一个 Assistant,所以它会在向用户建议结果之前做更多的计算。这意味着您的分享内容将成为 Google Assistant 学习的数据,Google Assistant 会用它做一些只有 Google 知道的事情,这不是一个像 if else 条件这样的清晰概念。另外,您可以关注 this 上的评论, 我认为这会有所帮助。

关于android - 向 Android Assistant 添加内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40131372/

相关文章:

android - 安卓 : Q texture coordinate not having any effect 上的 OpenGL ES 1.1

java - 停止 Jackson 自定义日期序列化器写入空值

ruby-on-rails - ruby rails : Capturing JSON data from webhook?

java - 如何在 Android Studio 中指定 JDK 版本?

android - 将 design.widget.BottomNavigationView 放置在相关布局的底部

android - SDK 管理器中的 Extras 文件夹中缺少 Google Play 服务

json - Haskell Servant 自定义 JSON 解析错误

Xcode 4 : Open arbitrary files in assistant editor

swift - Xcode 无法在类 UICollectionReusableView 的助理编辑器中打开正确的类

android - 将我的应用定义为 Google 助理的默认音乐服务