Android 如何将Google上的操作连接到adroid应用程序并传递参数

Android 如何将Google上的操作连接到adroid应用程序并传递参数,android,firebase,android-studio,dialogflow-es,actions-on-google,Android,Firebase,Android Studio,Dialogflow Es,Actions On Google,我对谷歌上的android和Actions非常陌生,我正在为大学做最后一个项目,需要将Actions和我创建的android应用程序进行集成 我已经能够创建一个应用程序,从Firebase检索信息并显示所有可供收养的宠物。在应用程序中,用户可以通过为类别、大小和最终品种选择嵌套微调器来过滤结果 我还在Google Actions控制台上创建了一个动作,它将根据Dialogflow中的两个意图与用户进行对话:查找宠物意图和后续意图 LookingForPet意图是向用户询问特定类别,如狗或猫,并询

我对谷歌上的android和Actions非常陌生,我正在为大学做最后一个项目,需要将Actions和我创建的android应用程序进行集成

我已经能够创建一个应用程序,从Firebase检索信息并显示所有可供收养的宠物。在应用程序中,用户可以通过为类别、大小和最终品种选择嵌套微调器来过滤结果

我还在Google Actions控制台上创建了一个动作,它将根据Dialogflow中的两个意图与用户进行对话:查找宠物意图和后续意图 LookingForPet意图是向用户询问特定类别,如狗或猫,并询问大小。根据用户的回复,Dialogflow将运行一个实现函数来检索与这些参数匹配的品种,并将其显示给用户,要求用户选择其中一个品种。用户回答该问题后,另一个实现函数将运行以检索找到的结果,显示数据库中与给定参数匹配的条目的基本信息

我现在需要做的是让Google助手在特定活动中打开应用程序,从对话动作中获取这些参数(类别、大小和品种)的值,并将它们存储在我的应用程序中的变量中,这样我就可以在屏幕上重建结果

我已经研究了一段时间了,但我不能正确地理解如何让它发生。据我所知,在我想要运行的特定活动的清单文件中,我需要一些意图过滤器,但我不确定如何做到这一点。你们谁能帮我一下吗

以下是我要启动的活动清单文件中的内容:

<activity android:name=".SearchResult">
    <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data
            android:host="pawdopter.myapp.com"
            android:scheme="https"/>
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.SELECT_CATEGORY" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.VOICE" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.SELECT_SIZE" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.VOICE" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.SELECT_BREED" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.VOICE" />
    </intent-filter>
</activity>

这是我的actions.xml文件,但我对其中的实现和参数映射部分感到困惑:

<actions>
    <action intentName="actions.intent.OPEN_APP_FEATURE">
        <fulfillment
            fulfillmentMode="actions.fulfillment.DEEPLINK"
            urlTemplate="https://pawdopter.myapp.com/open{?searchresult}">
            <parameter-mapping intentParameter="search" urlParameter="searchresult"/>
        </fulfillment>
    </action>
    <action intentName="actions.intent.SELECT_CATEGORY">
        <parameter name="category.name">
            <entity-set-reference entitySetId="CategoryEntitySet"/>
        </parameter>
        <fulfillment urlTemplate="intent:#Intent;package=com.myapp.pawdopter;action=com.myapp.pawdopter.SELECT_CATEGORY{;S.category};end">
            <parameter-mapping
                intentParameter="category.name"
                urlParameter="S.category"/>
        </fulfillment>
    </action>

    <action intentName="actions.intent.SELECT_SIZE">
        <parameter name="size.name">
            <entity-set-reference entitySetId="SizeEntitySet"/>
        </parameter>
        <fulfillment urlTemplate="intent:#Intent;package=com.myapp.pawdopter;action=com.myapp.pawdopter.SELECT_SIZE{;S.size};end">
            <parameter-mapping
                intentParameter="size.name"
                urlParameter="S.size"/>
        </fulfillment>
    </action>

    <action intentName="actions.intent.SELECT_BREED">
        <parameter name="breed">
            <entity-set-reference entitySetId="BreedEntitySet"/>
        </parameter>
        <fulfillment urlTemplate="intent:#Intent;package=com.myapp.pawdopter;action=com.myapp.pawdopter.SELECT_BREED{;S.breed};end">
            <parameter-mapping
                intentParameter="breed.name"
                urlParameter="S.breed"/>
        </fulfillment>
    </action>

    <entity-set entitySetId="CategoryEntitySet">
        <entity
            name="@string/category_dog"
            identifier="DOG"/>
        <entity
            name="@string/category_cat"
            identifier="CAT"/>
    </entity-set>

    <entity-set entitySetId="SizeEntitySet">
        <entity
            name="@string/size_small"
            identifier="SMALL"/>
        <entity
            name="@string/size_medium"
            identifier="MEDIUM"/>
        <entity
            name="@string/size_large"
            identifier="LARGE"/>
    </entity-set>

    <entity-set entitySetId="BreedEntitySet">
        <entity
            name="@string-array/breed"
            identifier="Golden Retriever"/>
    </entity-set>
</actions>

支持单一功能。您的用例不能用它来表示,除非您快速前进到单个功能,然后让您的应用程序从该点继续对话

此外,我认为您正在将会话行为内置意图(BII)和应用程序操作BII混为一谈,并且您的Actions.xml包含一个有效的应用程序操作BII(OPEN_App_功能)以及无效的BII。也就是说,请继续关注将满足您的用例的新特性