1

I am trying to implement app actions in my android app.when I am testing my app App action test tool V2.0.0 its working fine but whenever i try to give voice command or type ("start running in my app") it doesn't work.I have my app on play console and trying with same developer account

Expected that the Running activity launch with the voice command of the intent

action.xml

<!-- This file describes the supported actions by this app -->

<action intentName="actions.intent.START_EXERCISE">

    <!-- Each action requires at least one fulfillment that defines how the app will handle this action -->
    <!-- Define the urlTemplate in the format you define your deeplinks in AndroidManifest.xml -->

    <fulfillment urlTemplate="https://fit-actions.firebaseapp.com/start{?exerciseType}">

        <!-- Define how the actions parameters (intentParameter) is mapped in the urlTemplate above -->

        <parameter-mapping
            intentParameter="exercise.name"
            urlParameter="exerciseType" />

    </fulfillment>

    <!-- We can define our custom inline inventory, mapping a parameter to an entity set reference -->

    <parameter name="exercise.name">
        <entity-set-reference entitySetId="ExerciseEntitySet" />
    </parameter>

</action>

<action intentName="actions.intent.STOP_EXERCISE">
    <fulfillment urlTemplate="https://fit-actions.firebaseapp.com/stop" />
</action>

<action intentName="actions.intent.GET_EXERCISE_OBSERVATION">

    <!-- You can define the fulfillment mode, it can be SLICE or DEEPLINK -->
    <!-- When slice is used, make sure you are supporting slices in your app -->
    <!-- Also, not that the urlTemplate must be of the style content://{slice_provider_authority}/... -->

    <fulfillment
        fulfillmentMode="actions.fulfillment.SLICE"
        urlTemplate="content://com.devrel.android.fitactions.FitSliceProvider/stats{?exerciseType}">

        <!-- If a parameter is set as required, the action will only be fulfilled if the parameter is found -->
        <!-- That's why a fallback urlTemplate needs to be provided for such case. -->

        <parameter-mapping
            entityMatchRequired="true"
            intentParameter="exerciseObservation.aboutExercise.name"
            required="true"
            urlParameter="exerciseType" />

        <!-- Note, that for the parameter above we are setting entityMatchRequired="true" -->
        <!-- This tells the Assistant to only use the entity set values to map this parameter -->
        <!-- Meaning that even if the assistant know how to identify the exercise (i.e "Climbing") -->
        <!-- if it's not defined in our entity set, the parameter won't be use. -->

    </fulfillment>

    <!-- In case the exercise name is not found we fallback to the stats deep-link inside the app -->

    <fulfillment
        fulfillmentMode="actions.fulfillment.DEEPLINK"
        urlTemplate="https://fit-actions.firebaseapp.com/stats" />

    <!-- Same as the first action, we map the parameter name with out supported entity set. -->

    <parameter name="exerciseObservation.aboutExercise.name">
        <entity-set-reference entitySetId="ExerciseEntitySet" />
    </parameter>

</action>

<!-- Defines an entity set with our supported entities -->

<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="@string/activity_running"
        alternateName="@array/runningSynonyms"
        identifier="RUNNING" />
    <entity
        name="@string/activity_walking"
        alternateName="@array/walkingSynonyms"
        identifier="WALKING" />
    <entity
        name="@string/activity_cycling"
        alternateName="@array/cyclingSynonyms"
        identifier="CYCLING" />
</entity-set>

menifest code

 <activity
        android:name=".BaseE12"
        android:alwaysRetainTaskState="true"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:keepScreenOn="true"
        android:label="@string/app_name"
        android:launchMode="singleTop"
        android:showOnLockScreen="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>


        <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> <meta-data
        android:name="com.google.android.actions"
        android:resource="@xml/actions" />

idea.log

Successful Submit Actions Response:{
  "assistantLink": "https://assistant.google.com/services/invoke/uid/000013ca101a9334",
  "supportedIntents": [
    {
      "name": "actions.intent.START_EXERCISE",
      "supportedParameters": [
        {
          "name": "exercise",
          "exampleValues": [
            "{\"@context\":\"http://schema.googleapis.com\",\"@type\":\"Exercise\",\"name\":\"Running\"}"
          ]
        }
      ]
    },
    {
      "name": "actions.intent.STOP_EXERCISE",
      "supportedParameters": [
        {
          "name": "exercise",
          "exampleValues": [
            "{\"@context\":\"http://schema.googleapis.com\",\"@type\":\"Exercise\"}"
          ]
        }
      ]
    },
    {
      "name": "actions.intent.GET_EXERCISE_OBSERVATION",
      "supportedParameters": [
        {
          "name": "exerciseObservation",
          "exampleValues": [
            "{\"@context\":\"http://schema.googleapis.com\",\"aboutExercise\":{\"name\":\"Climbing\",\"@type\":\"Exercise\"},\"@type\":\"ExerciseObservation\"}"
          ]
        }
      ]
    }
  ],
  "previewSettings": {
    "invocationName": "my app"
  }
}
Chathura Wijesinghe
  • 3,310
  • 3
  • 25
  • 41
  • are you calling your app using the name you defined as its preview name? – Sonia Aug 27 '19 at 15:44
  • @Sonia yes i'm using same name – Aquib Shaikh Aug 28 '19 at 04:44
  • That's odd, considering that if you're logged into the assistant with your developer account and have triggered it initially with the plugin it should work. Maybe file a bug? – Sonia Aug 28 '19 at 13:11
  • @Sonia is there any thing wrong in my code or first I have to upload app with action.xml on play store before testing on Google assistant – Aquib Shaikh Aug 29 '19 at 04:35
  • 1
    I don't see anything wrong with your code. I'm pretty sure you are just using the appactions fitness sample provided by google. And no, you don't need to upload action.xml on play store to test it on the google assistant. If it works by triggering it via the plugin and then it doesn't work later by voice, something must be wrong but not on your end. – Sonia Aug 29 '19 at 13:39
  • You should checkout the suggestions here: https://github.com/actions-on-google/appactions-fitness-kotlin/issues/8 Removing the entity sets might help – Sonia Aug 29 '19 at 14:42
  • Thanks for your valuable responce i will check and let you know – Aquib Shaikh Aug 29 '19 at 16:25
  • @Sonia sorry for late response but solution on given link is not working for me – Aquib Shaikh Sep 03 '19 at 05:08

0 Answers0