[英]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 运行它。
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创建预览后,您可以测试运行的小部件
Setting the Intent to GET_EXERCISE_OBSERVATION
将 Intent 设置为
GET_EXERCISE_OBSERVATION
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.) (“攀登”也可以,但会告诉您您没有记录该活动。)
Making sure the target device is the one you're testing on.确保目标设备是您正在测试的设备。
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:
使用测试工具创建预览后,您可以直接在设备上进行测试:
Start the Assistant by long-pressing on the home button.长按主页按钮启动助手。
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:
我经常(但并非总是)做过的几件事有帮助:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.