android - Google Actions does not work from OK Google. my app is not recognised


Question: 

I have downloaded this basic example from google: https://github.com/actions-on-google/appactions-fitness-kotlin

Now if I do:

adb shell am start -a android.intent.action.VIEW -d "https://fit-actions.firebaseapp.com/start"

It will start my app. And the deeplink is being recognized. The example shows that I can do this by saying in Google Assistant:

Start running in fit actions

Now I do this, but this only gives me Google search responses, it does not start my app similar to the adb shell command. I did change the package name, so that it complies with my google-services.json file.

What am I doing wrong?

This is what I have in my Manifest:

  <activity
        android:name=".activity.MainActivity"
        android:configChanges="orientation"
        android:exported="true"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize|stateUnchanged">
        <!-- 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">
            <action android:name="android.intent.action.VIEW"/>

            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE"/>

            <data
                android:host="com.package.android"
                android:scheme="https"/>
        </intent-filter>
    </activity>

This is my actions.xml

 <?xml version="1.0" encoding="utf-8"?><!--

<actions>

<!-- 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://com.package.android/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://com.package.android/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.package.android.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://com.package.android/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>

If I try App Actions Test Tool v2.00 it doesn't find the app. The exercise also always goes back to this format with http://schema.googleapis.com

enter image description here

EDIT:

After setting actions like this:

<actions>
<action intentName="actions.intent.OPEN_APP_FEATURE">
    <fulfillment urlTemplate="https://www.xelion.com/start{?feature}">
        <parameter-mapping
            intentParameter="featureType"
            urlParameter="feature"/>
    </fulfillment>

    <parameter name="featureType">
        <entity-set-reference entitySetId="EntitySet"/>
    </parameter>
</action>

<entity-set entitySetId="EntitySet">

    <!-- 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/action_call"
        alternateName="@array/callSynopsis"
        identifier="CALL"/>

</entity-set>

I get this when pressing on update preview in App Action Test Tool:

App Actions Test Tool v2.0.0
        Preview Creation Error
        Status Code: 400
        Message: Precondition check failed.
        - Parameter name 'featureType' is invalid for intent 'actions.intent.OPEN_APP_FEATURE.'
        - Parameter name 'featureType' is invalid for intent 'actions.intent.OPEN_APP_FEATURE.'

Any ideea why?




1 Answer: 

You need to first trigger the action using the App Actions Test Plugin: https://plugins.jetbrains.com/plugin/12322-app-actions-test-tool

Once you've installed the plugin, you'll find it under 'Tools' and you can define an invocation name for your app + parameters.

From then on, you can trigger it using "Ok Google".

 

More Articles


Firefox extension to get google pagerank and alexa ranking

I am creating a Mozilla Firefox toolbar to show PageRank and Alexa ranking of current website. One way I came to know is to use XMLHttpRequest in my JavaScript file to get information from a PHP page hosted on my website's server. The PHP class has this function:function check($page) {// Open a soc

ruby - rails and balanced payments - Tokenize and add bank account

I'm using balanced payments with my rails 4 app and I need some help on how to tokenize and add a bank account. I'm not sure what I'm doing wrong. I read the docs and followed this gist . I'm getting a 200 ok status and I don't see any errors in the logs. However, when i check the response on my tes

templates - symfony - Call an action from view?

I know it's not good to try to do this, but i would like to call an action in my view/template on symfony framework.Is it possible ? I don't find anything about this on the web.Thanks you, and sorry for my bad english!!


botframework - Few question about Microsoft Teams using bot

It is possible to force a bot to join (and listen) all teams, meetings, chats conversation in my tenant without being invited or beginning the conversation?When a member was added to a team, my bot received a "conversationUpdate" message with the member that was added in the "memberAdded" field. I w

How To Get Alexa Ranking In Java

I tried to use Java and DOM XML parser to get the Alexa ranking from below :http://data.alexa.com/data?cli=10&url=domainNameIs there any API for Alexa ranking and other useful for particular URL ?

payflowpro - How to use paypal payflow api to charge sale in canadian dollars

I have a custom application that is integrated with the paypal payflow API. We are expanding to Canada and would like to charge in the Canadian dollar for our Canadian customers but it keeps defaulting to the US Dollar.I'm trying to pass 'CURRENCY'=> 'CAD' in the REST call via curl. I can't find a


botframework - Ms Teams Bot Icon is not displayed

I've used app studio from MS Teams to creat a manifest for a Bot App. I've uploaded the full color picture as well as trasparent outlone. However the icon is not displaying at the chat window. Only the default icon is visivle. Any ideas, how can I solve the issue? Thanks a lot!

react native - Cannot read property 'reload' of null using firebase.auth().currentUser.reload()

I need to reload current user to update emailVerfied status. However At first login or signup of user. The app return an error that Cannot read property 'reload' of null when A user press triggers firebase.auth().currentUser.reload(). However If I refresh the reload the app the reload function wor

php - Payflow Pro Currency Configuration Issue

I am new to the Payflow Pro platform and have recently set up single and recurring transactions in the sandbox mode and they all work fine.My issue is i am unable to configure the test payflow manager to accept and work with another currency other than USD. I need to be able to use GBP. When I first

With Actions on Google, what is the recommended way to get the user's country with coarse location information?

The getDeviceLocation() call may return either lat/lon coordinates if the surface provides precise location information or a ZIP code and a city for coarse location information.With the former one can use the Google Maps API to reverse-geocode the coordinates, the latter, however, can be ambiguous a