简体   繁体   English

使用谷歌助手没有调用小部件的问题

[英]The problem of widget isn't invoked using google assistant

Do anyone have the similar problem to control Android apps (from google codelab - fitness app) with their voice, using Google Assistant?有没有人有类似的问题来控制 Android 应用程序(来自谷歌代码实验室 - 健身应用程序)用他们的声音,使用谷歌助理?

In my app, I tried to activate widget using google assistant (app action tool test), but google assistant doesn't give any respond.在我的应用程序中,我尝试使用谷歌助手(应用程序操作工具测试)激活小部件,但谷歌助手没有给出任何响应。 Therefore, I used the example code google gave to run, but it still has similar problem that widget isn't invoked when I use app action tool test to test the app.因此,我使用了谷歌给出的示例代码来运行,但是当我使用应用操作工具测试来测试应用程序时,它仍然存在类似的问题,即没有调用小部件。

Sample code google provided: https://github.com/actions-on-google/appactions-fitness-kotlin.git谷歌提供的示例代码: https://github.com/actions-on-google/appactions-fitness-kotlin.git

the shortcut looks like below and how:快捷方式如下所示以及如何:
enter image description here在此处输入图像描述

Update:更新:

After updating the new running record, the app won't respond when I want to trigger widget after the first time I can do it successfully.更新新的运行记录后,第一次成功后想触发小部件时,应用程序没有响应。 Do anyone have similar question or know how to solve it?有没有人有类似的问题或知道如何解决?

App updates running record应用更新运行记录

The widget cannot update/display the new running record小部件无法更新/显示新的运行记录

widget cannot be trigger to get new running record无法触发小部件以获取新的运行记录

I'm assuming you're talking about the codelab titled Integrate Android Widgets with Google Assistant .我假设您正在谈论名为Integrate Android Widgets with Google Assistant的代码实验室。

I've been able to get this codelab to work - mostly.我已经能够让这个 codelab 工作 - 主要是。

When testing using the App Actions test tool:使用 App Actions 测试工具进行测试时:

  • Make sure you have uploaded the app to a project in the Google Play Console.确保您已将应用上传到 Google Play 控制台中的项目。 You'll only need to do this once, even if you change your code.即使您更改了代码,您也只需要这样做一次。

  • Make sure the account you're using for Android Studio, Play Console, and Google Assistant on your device are all the same.确保您在设备上用于 Android Studio、Play 控制台和 Google 助理的帐户都相同。

  • Make sure you've compiled the app and deployed it to your device.确保您已编译该应用程序并将其部署到您的设备。 The easiest way to do this just to run it from Android Studio the first time.最简单的方法是第一次从 Android Studio 运行它。

    在 Android Studio 上运行小部件

  • When you create the preview, set the name and Locale.创建预览时,设置名称和区域设置。

    • Even tho these are listed as "optional", these make it easier to debug.即使这些被列为“可选”,它们也更容易调试。

    • The App name should be something you know will be recognized by voice and not used by any other app.应用程序名称应该是您知道可以通过语音识别并且不会被任何其他应用程序使用的名称。 I tend to use things like "Splat" and "Bogus".我倾向于使用“Splat”和“Bogus”之类的东西。

    • Set the locale to en-US将语言环境设置为 en-US

    • Click "Create Preview"点击“创建预览”

    应用操作测试工具图片

  • Once the preview is created, you can test the widget running by创建预览后,您可以测试运行的小部件

    1. Setting the Intent to GET_EXERCISE_OBSERVATION将 Intent 设置为GET_EXERCISE_OBSERVATION

    2. Changing the value in the "name" property to something like "run" .将 "name" 属性中的值更改为"run"之类的值。 ("Climbing" will also work, but tell you that you don't have that activity logged.) (“攀登”也可以,但会告诉您您没有记录该活动。)

    3. Making sure the target device is the one you're testing on.确保目标设备是您正在测试的设备。

    4. Clicking Run App Action单击运行应用程序操作

    And you should see the widget appear in the Assistant on the device.您应该会看到该小部件出现在设备的助手中。

    测试工具和模拟器

You don't need to use the test tool, however.但是,您不需要使用测试工具。 Once you have created the preview with the Test Tool, you can just test it right on the device:使用测试工具创建预览后,您可以直接在设备上进行测试:

  1. Start the Assistant by long-pressing on the home button.长按主页按钮启动助手。

  2. Saying or typing a request such as "How far have I run with Bogus" ("Bogus" being the name I've chosen this time说出或输入一个请求,例如“我和 Bogus 一起跑了多远”(“Bogus”是我这次选择的名字

模拟器

If you have issues with the emulator, there are some other troubleshooting steps which may be useful depending on the error message you get.如果您在使用模拟器时遇到问题,还有一些其他故障排除步骤可能有用,具体取决于您收到的错误消息。

Now, I did say "mostly".现在,我确实说“大部分”。 I have seen issues where it will stop responding at all, either via the Test Tool or directly via the Assistant.我已经看到了通过测试工具或直接通过助手完全停止响应的问题。 A few things that I've done that often (but not always) help:我经常(但并非总是)做过的几件事有帮助:

  • Delete and then create the preview again.删除然后再次创建预览。 Remember that the Preview is only available for a few hours.请记住,预览版仅在几个小时内可用。
  • Force stop the application.强制停止应用程序。
  • Force stop the Google Assistant.强制停止 Google 助理。
  • Even if you don't see a message, check out the Troubleshooting steps for "Sorry, I couldn't find that"即使您没有看到消息,请查看“抱歉,我找不到”的故障排除步骤

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

相关问题 Google 助手无法从 BII“actions.intent.GET_ACCOUNT”获取自定义帐户名 - Google assistant can't get custom account name from BII “actions.intent.GET_ACCOUNT” 无需服务器连接即可将 Google 助理集成到应用程序 - Google assistant intergration to app without server connection 如何通过代码检查设备中是否可以使用 Google Assistant? - how to check if Google Assistant is available in a device by code? Google 助理未在 Android 应用程序上使用新的 URI - Google assistant not taking the new URI on Android app 在 App Actions Google Assistant 中开发笔记和清单 - Develop notes & lists in App Actions Google Assistant Android TV 中的谷歌助手和应用操作问题 - Problem with google assistant and app actions in Android TV Android - Google 助理未提供 CREATE_CALL BII 的号码 - Android - Google Assistant not providing the number for CREATE_CALL BII 是否可以使用 Google Assistant 播放一些文本? - Is it possible to playback some text using Google Assistant? 如何使用 Google Assistant 测试 App Actions? - How to test App Actions using Google Assistant? App Action 通过 App Action Tool Plugin 工作,但不能在 Google Assistant 屏幕中使用语音命令 - App Action working via App Action Tool Plugin but not with voice command in Google Assistant Screen
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM