tudor
tudor

Reputation: 508

Can Google Assistant (still) be integrated with a Flutter or Android app?

I'm working on integrating Google Assistant for an Android app built using Flutter. I want to trigger some code in the app using a phrase like "Hey Google, check status in My Cat app". It should go first to native Android, then I'll pass it to Flutter.

The solution seems to be app actions. I've followed the prerequisites in the documentation, but the tooling is broken and I can't figure out how to make it work.

Regarding the conditions

  1. The app is available in prod, with a build that does not contain a shortcuts.xml res nor the meta-data in the manifest.
  2. I am not the owner of the project in Google Play Console, but I am added as member.
  3. I am signed in Android Studio, Android physical device and Google Play Console with the same gmail account.
  4. I'm unable to use the Android Studio plugins for Google Assistant (Google Assistant plugin + App Actions Test Tool plugin). I have tried Android Studio (Apple Silicon) versions: Dolphin, Electric Eel, Hedgehog, Koala. Neither of them can run the plugins successfully. I also have the Dart and Flutter plugins installed. The closest to doing something is Electric Eel. If I open the Flutter project and try to create a preview, it briefly flashes a progress bar and does nothing else. If I open the /android folder and try to create a preview, I get the error
Google Assistant plugin v3.2.2
Preview Creation Error Status Code: 500 Message: Internal error encountered.
Create shortcuts.xml
  1. In the manifest, inside MainActivity there is <meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" />
  2. app/src/main/res/xml/shortcuts.xml is below
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
    <capability android:name="actions.intent.GET_SERVICE_OBSERVATION">
        <intent
            android:targetPackage="cat.my.app"
            android:targetClass="cat.my.app.MainActivity">
            <parameter
                android:name="serviceObservation.measuredProperty.name"
                android:key="name" />
            <parameter
                android:name="serviceObservation.aboutService.description"
                android:key="description" />
            <parameter
                android:name="serviceObservation.endTime"
                android:key="endTime"/>
            <parameter
                android:name="serviceObservation.startTime"
                android:key="startTime"/>
        </intent>
    </capability>
    <shortcut
        android:shortcutId="status"
        android:shortcutShortLabel="@string/status_short_label"
        android:shortcutLongLabel="@string/status_long_label">
        <capability-binding android:key="actions.intent.GET_SERVICE_OBSERVATION">
            <parameter-binding
                android:key="serviceObservation.measuredProperty.name"
                android:value="@array/status_synonyms" />
        </capability-binding>
    </shortcut>
</shortcuts>

Do you have ideas what could be wrong? If somebody has greater experience with Google Assistant, it might be helpful to understand

  1. Are there some studio/plugin versions that still work for Google Assistant?
  2. Could it be an issue that I'm not an owner/admin in the project?
  3. Should a build that contains shortcuts.xml be uploaded to Google Play? Would this enable the app action for testing?

Many thanks!

Upvotes: 1

Views: 207

Answers (0)

Related Questions