【问题标题】:Google Assistant integration with my custom app?Google 助理与我的自定义应用程序集成?
【发布时间】:2018-08-30 10:39:26
【问题描述】:

我正在学习 google 操作,并制作了一个基本的、类似 google-keep 的应用程序,它记录登录用户的笔记。它有一个移动客户端和一个 Firebase 服务器。我想知道是否可以让助手以这样的方式进行交互,即可以通过助手会话创建笔记而根本不打开移动客户端。 例如:

User (on any screen): "hey google"
AI - "hi , how can i help?"
U - " place a note to call david in customNotter" ( suppose)
Ai - "am sorrry, customnotter  does not exist on your mobile , download it from playstore http"//www.link..." 
U - *downloads customNotter app , installs, logs himself in*
U - " place a note to call david in customNotter"
Ai - "Ok, your note is saved"
*saves note "call david" in customNotter (by somehow calling some code to interact with customNotter's server?)*

我可以想象一个 kotlin 代码可以包含在我的应用程序中,助手可以触发它可以简单地将便笺添加到服务器,但无法想象助手如何使用用户的身份验证详细信息和便笺数据触发该代码?


PS:我也想知道谷歌主页是否也可以集成到这样的应用程序中。如果不是,限制 google home 不与我的服务器交互的关键因素是什么?比如假设正在为 CustomNotter 构建一个完整的业务模型,其中有一个统一的服务器和许多客户端,如 ios/android/web 应用程序。 google home 能否像另一个经过身份验证的客户端一样直接与服务器交互?

【问题讨论】:

    标签: android actions-on-google


    【解决方案1】:

    最好的选择是使用 Actions on Google 直接调用您的 Firebase 服务器并以这种方式更新数据库。目前,与 Android 应用程序的联系并不深。 Android Actions 已宣布,但目前不可用。

    这样做的好处是,您的 Action 可以在 Android 手机以外的任何 Google 助理界面上运行,并且不需要用户安装您的应用。

    由于您可以在 Firebase Functions 上运行 Actions on Google,因此很容易将其合并到您的 Firebase 数据库中。

    【讨论】:

      【解决方案2】:

      您在这里做了几个假设,但在我做出不同的假设之前,我想澄清一些事情。您说“它有一个移动客户端和一个 firebase 服务器”。我假设“firebase 服务器”是存储用户笔记的地方?

      如果是这样,那么您根本不需要在本地安装该应用程序即可让 Google 助理使用它。您只需要确保您的移动应用程序和您的操作都具有相同的用户帐户引用,以便它们可以更新和读取数据库中的相同记录。这适用于智能助理可以运行操作的任何地方 - 在移动设备上或在 Google Home 等扬声器上。

      在这种情况下,您的对话可能如下所示:

      User: Hey Google, ask Custom Notter to remind me to call David.
      Assistant: Getting Custom Notter
      [Earcon, indicating your Action is running]
      Action: Hi there. I've added a note to call David.
      [Earcon, indicating the Action is done]
      

      这是一个非常简单的对话示例。其他对话流可能还需要指示用户是否尚未将此类应用连接到帐户,或者您可能需要提示他们获得使用其帐户的权限等。

      您将需要编写服务器代码来处理处理 - 所有操作都与在云中的服务器上运行的 webhook 交互。你可以用任何你想要的语言编写它,包括 Kotlin,也可以在任何你想要的服务上编写 - 但是如果你在 node.js 中使用 Firebase Cloud Functions 或在 Google 的云上运行它,Google 会提供库和其他支持。

      所有详细信息都可以在https://developers.google.com/actions/获得

      如果您有移动应用,并且想了解如何让 Google 助理在该应用中启动内容,您可以查看即将在 Android 上推出的 App Actions

      【讨论】:

        猜你喜欢
        • 2019-06-15
        • 2019-11-25
        • 2019-03-22
        • 2018-03-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多