Reputation: 1325
Google assistant doesn't catch the custom intent. I've implemented custom intent and it triggers fine from Test Tool. It works from Test Tool just fine.
But I can't figure out how to register this capability or shortcut in google assistant so it starts resolving the requests.
It works perfectly with BII.
Custom intent(shortcuts.xml):
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<shortcut
android:shortcutId="GET_STATUS"
android:shortcutShortLabel="@string/assist_get_status"
android:enabled="true">
<capability-binding android:key="custom.actions.intent.GET_STATUS"/>
</shortcut>
<capability
android:name="custom.actions.intent.GET_STATUS"
app:queryPatterns="@array/assistant_queries_get_status">
<app-widget
android:identifier="GET_STATUS_WIDGET"
android:targetClass="<MY APP ID>.ui.assistant.GetStatusWidgetProvider"
android:targetPackage=<MY APP ID>
<extra android:name="hasTts" android:value="true"/>
</app-widget>
<intent
android:identifier="GET_STATUS_FALLBACK"
android:action="android.intent.action.VIEW"
android:targetClass="<MY APP ID>.ui.assistant.GetStatusWidgetProvider">
</intent>
</capability>
</shortcuts>
Query patterns:
<string-array name="assistant_queries_get_status">
<item>(to)? get (my)? status</item>
<item>(to)? check status</item>
<item>how is home</item>
<item>get (my)? sensors statuses</item>
<item>what is the status (at home)?</item>
<item>how is the house</item>
<item>provide (a)? status report</item>
</string-array>
In manifest I have:
<receiver
android:name=".ui.assistant.GetStatusWidgetProvider"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/button_widget" />
</receiver>
<service
android:name=".ui.assistant.GetStatusWidgetProvider"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.assistant.appactions.widgets.PIN_APP_WIDGET" />
</intent-filter>
</service>
And I added shortcuts meta-data to launch activity as well.
The query I tried: "Hey Google, ask TEST APP how is home?" and it doesn't work.
If I change the capability and shortcut to actions.intent.GET_EXERCISE_OBSERVATION
(and remove queryPatterns of course) and try something like:
"Ask TEST APP, "How many miles have I run today?"." - it works!
I also ran an internal test in GP, logged in the same account in Android Studio as on my test device, the same that I use in GP to publish and internal testing - all the same. From Test Tool - works, from Assistant - nope.
I can't understand if I missed something or it's a bug.
Any help is highly appreciated, thank you!
Upvotes: 0
Views: 214