【发布时间】:2023-11-18 12:10:01
【问题描述】:
这是我的 actions.xml 操作,关于 GET_EXERCISE_OBSERVATION
<action intentName="actions.intent.GET_EXERCISE_OBSERVATION">
<fulfillment urlTemplate="https://www.xelion.com/stats{?exerciseType}">
<parameter-mapping
entityMatchRequired="true"
intentParameter="exerciseObservation.aboutExercise.name"
required="true"
urlParameter="exerciseType" />
</fulfillment>
<parameter name="exerciseObservation.aboutExercise.name">
<entity-set-reference entitySetId="ExerciseEntitySet" />
</parameter>
</action>
这是我的练习实体集:
<entity-set entitySetId="ExerciseEntitySet">
<!-- For each entity you can specify the name, alternate names and the identifier -->
<!-- The identifier is the value that will be added to the action uri. -->
<!-- For our sample we map the supported entities with the class FitActivity.Type -->
<entity
name="running"
identifier="RUNNING" />
<entity
name="walking"
identifier="WALKING" />
<entity
name="cycling"
identifier="CYCLING" />
</entity-set>
如您所见,参数映射严格表示 REQUIRED 和 entityMatchRequired="true" 但是当我运行应用操作测试工具和“更新预览”时,它会说:
13:09 App Actions Test Tool v3.0.0
Preview Creation Error
Status Code: 400
Message: Precondition check failed.
- There is no URL template for action 'actions.intent.GET_EXERCISE_OBSERVATION' with zero required parameters.
我确实从他们的示例中复制了这个: https://github.com/actions-on-google/appactions-fitness-kotlin/tree/master/app/src/main/java/com/devrel/android/fitactions
为什么不编译。为什么它不能识别我的参数?
【问题讨论】:
-
我在
GET_FOOD_OBSERVATION上遇到了类似的问题,在我的参数化<fulfillment>解决了我的问题之后,似乎添加了另一个没有参数的<fulfillment>。因此,例如,可以尝试在关闭</fulfillment>节点后添加<fulfillment urlTemplate="https://www.xelion.com/stats">。我认为它可能需要作为后备。
标签: android kotlin voice-recognition voice app-actions