首页 > 解决方案 > 为什么 getIntent().getData() 为 getIntent() actions.intent.OPEN_APP_FEATURE 返回 null?

问题描述

我从Google 的官方文档中机械地复制了代码,以测试将 Google Assistant 操作与应用程序集成:

  <?xml version="1.0" encoding="utf-8"?>
  <!-- This is a sample actions.xml -->
  <actions>
    <action intentName="actions.intent.OPEN_APP_FEATURE">
      <!-- Use url from inventory match for deep link fulfillment -->
      <fulfillment urlTemplate="{@url}" />


      <!-- Define parameters with inventories here -->
      <parameter name="feature">
        <entity-set-reference entitySetId="featureParamEntitySet"/>
      </parameter>
    </action>

    <entity-set entitySetId="featureParamEntitySet">
      <!-- Provide a URL per entity -->
      <entity url="myapp://deeplink/one" name="featureParam_one"/>
      <entity url="myapp://deeplink/two" name="featureParam_two"/>
    </entity-set>
  </actions>

以上是actions.xml的内容。App Actions Test Tool 对此很满意。当我单击运行时,应用程序已打开,但 getIntent().getData() 返回 null。

任何人都可以对此有所了解吗?

标签: androidapp-actionsgoogle-assistant

解决方案


推荐阅读