How to integrate the OPEN_APP_FEATURE action into an Android application?

Viewed 3779

I want to be able to launch some features of my Android app ("Start", "Stop"), through voice commands from Google Assistant.

  1. What are the next steps to be able to launch these features from Google Assistant?
  2. What are the natural language queries supported by this Open App Feature?

I have integrated actions.intent.OPEN_APP_FEATURE into my app and tested it successfully through the App Actions Test Tool in Android Studio.

My actions.xml:

<?xml version="1.0" encoding="utf-8"?>
<actions>
    <action intentName="actions.intent.OPEN_APP_FEATURE">
        <fulfillment urlTemplate="http://www.my-app.com/{?featureName}">
            <parameter-mapping
                intentParameter="feature"
                urlParameter="featureName" />
        </fulfillment>

        <parameter name="feature">
            <entity-set-reference entitySetId="FeatureEntitySet" />
        </parameter>
    </action>

    <entity-set entitySetId="FeatureEntitySet">
        <entity
            name="@string/start_capture"
            identifier="START" />
        <entity
            name="@string/stop_capture"
            identifier="STOP" />
    </entity-set>
</actions>

When asking Google Assistant something like "Open start from MyApp" I was expecting the same behavior as when testing through the App Actions Test Tool (open the feature of the app), but Google Assistant provides generic web results instead.

2 Answers

It turns out, that there is a bug preventing from triggering an Open App Feature from Google Assistant.

As per the docs for OPEN_APP_FEATURE:

Supported entities

You must specify entities for feature.

Therefore you should try providing the values your app supports for the feature parameter using inline inventory. This allows you to tell Assistant what values to expect for that parameter. There is also an example of this in the sample app here.

The docs should definitely have sample queries to better guide how to test this (will see if we can get that updated).

I believe what you are testing should work - "Open [feature] on MyApp". If it's not working via voice but it is working via Test Tool then that might be a bug. Only thing to check is the invocation name set up in the Test Tool matches what you are testing with ("MyApp" above). Otherwise you can file a bug here.

Related