问题
Tested on android version 7.2 . Works fine when user queries "Check saving balance from mybank " or "Check current balance in mybank" where mybank is app name created in APP action test tool.
intent is called and onBindSlice receives parameter "saving" and "current" as parameter but does not work for "Check Balance in mybank" no parameter is captured. how can i make custom user queries work?
here is my google actions file
<?xml version ="1.0" encoding ="utf-8"?><!-- Learn More about how to use App Actions: https://developer.android.com/guide/actions/index.html -->
<actions>
<!-- Example Action -->
<!-- <action intentName="Intent name (actions.intent.*)"> -->
<!-- <action-display -->
<!-- icon="@mipmap/..." -->
<!-- labelTemplate="@array/..." /> -->
<!-- <fulfillment urlTemplate="Action content URI or URL"> -->
<!-- <parameter-mapping -->
<!-- intentParameter="Parameter name in Intent URI" -->
<!-- urlParameter="Parameter name in URL" /> -->
<!-- </fulfillment> -->
<!-- </action> -->
<action intentName="actions.intent.GET_ACCOUNT">
<parameter name="account.name">
<entity-set-reference entitySetId="AccountEntitySet"/>
</parameter>
<entity-set entitySetId="AccountEntitySet" >
<entity
name="balance"
identifier="1" />
<entity
name="wallet"
identifier="2" />
/>
</entity-set>
<fulfillment
fulfillmentMode="actions.fulfillment.SLICE"
urlTemplate="content://spice.mudra.google_actions{?accountType}">
<parameter-mapping
urlParameter="accountType"
intentParameter="account.name"
required="true"/>
</fulfillment>
<fulfillment
fulfillmentMode="actions.fulfillment.DEEPLINK"
urlTemplate="https://fit-actions.firebaseapp.com/stats" />
</action>
</actions>
Code in manifest.
<provider
android:name=".google_actions.MySliceProvider"
android:authorities="spice.mudra.google_actions"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.app.slice.category.SLICE" />
</intent-filter>
</provider>
<meta-data
android:name="com.google.android.actions"
android:resource="@xml/actions" />
<activity
android:name=".activity.SplashActivity"
android:label="@string/app_name"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/MyMaterialTheme.Base.blue">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Required to support search action intents from Google Search -->
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<!-- Define your supported deeplinks -->
<intent-filter
android:autoVerify="true"
tools:targetApi="m">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="fit-actions.firebaseapp.com"
android:scheme="https" />
</intent-filter>
</activity>
回答1:
I've just tested again and it seems to be working with inline inventory(custom entities). Please try again and let me know how it goes.
来源:https://stackoverflow.com/questions/61673624/built-in-intent-actions-intent-get-account-in-app-actions-not-called-by-user-q