简体   繁体   中英

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?

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

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 .

I've been able to get this codelab to work - mostly.

When testing using the App Actions test tool:

  • Make sure you have uploaded the app to a project in the Google Play Console. 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.

  • 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".

    • Set the locale to 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

    2. Changing the value in the "name" property to something like "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

模拟器

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.
  • Even if you don't see a message, check out the Troubleshooting steps for "Sorry, I couldn't find that"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM