在 android 版本 7.2 上测试。当用户查询“检查 mybank 中的储蓄余额”或“检查 mybank 中的当前余额”时工作正常,其中 mybank 是在 APP 操作测试工具中创建的应用程序名称。
intent 被调用并且 onBindSlice 接收参数“ Saving ”和“ current ”作为参数,但 不适用于“Check Balance in mybank”,没有捕获任何参数。如何使自定义用户查询起作用?
这是我的谷歌操作文件
<?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>
清单中的代码。
<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>