Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

can't run in google assistant #12

Open
mmaSunshine opened this issue Nov 6, 2019 · 9 comments
Open

can't run in google assistant #12

mmaSunshine opened this issue Nov 6, 2019 · 9 comments

Comments

@mmaSunshine
Copy link

when i test on virtual device ,it's run normally.but when i test in my phone ,it can't runin google assistant ,and the assistant remind me "soory,can't find it".the process i make sure:
1.change the application id in my own.
2.upload the apk to google play console.
3.make sure the same account in google play console,Android Studio,google assistant in test device.
4.make sure the google is latest vision.
5.deleted actions preview and updated again from AATT.(App Actions Test Tool)
and then i looking at the logcat for the exact Intent that Assistant is trying to call. and i see the package name is not the package name i set .
how can i address this issue.

i also have a question.i want run this demo on Android TV,but when i use AATT and run ,it remind "no app to process".i wonder know if the apk can called by google assistant on TV

@dzuluaga
Copy link
Contributor

dzuluaga commented Nov 6, 2019

It's possible that your actions.xml and AndroidManifest.xml have an inconsistency. Could you upload them and remove any sensitive package data?

@mmaSunshine
Copy link
Author

It's possible that your actions.xml and AndroidManifest.xml have an inconsistency. Could you upload them and remove any sensitive package data?

Before I upload apk to google play console,I cmment the
<meta-data android:name="com.google.android.actions" android:resource="@xml/actions" />
and then generate the signed apk which I upload to google play console.
Also I change the package name in my own.In my project, the action.xml and AndroidManifest.xml as follows:

AndroidManifest.xml

`

<!-- Needed permission to start the FitTrackingService in foreground mode -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<application
    android:name="com.devrel.android.appactions.FitApp"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    tools:ignore="GoogleAppIndexingWarning">

    <activity
        android:name="com.devrel.android.appactions.FitMainActivity"
        android:exported="true"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:theme="@style/AppTheme.NoActionBar">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

        <!-- 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"
            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>

    <service
        android:name="com.devrel.android.appactions.tracking.FitTrackingService"
        android:enabled="true"
        android:exported="true" />

    <!-- Define your SliceProvider, you can define the authority name as you prefer but -->
    <!-- remember that authorities must be unique between different apps -->
    <!-- https://developer.android.com/guide/topics/providers/content-provider-creating#designing-an-authority -->
    <!-- This authority is used as urlTemplate for app actions with Slices -->
    <!-- And to grant access to SliceManager, see grantAssistantPermissions in FitApp.kt -->
    <provider
        android:name="com.devrel.android.appactions.slices.FitSliceProvider"
        android:authorities="com.devrel.android.appactions.slices.provider"
        android:exported="true">

        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.app.slice.category.SLICE" />
        </intent-filter>

    </provider>

    <!-- Add an indication where to find the actions.xml -->
    <meta-data
        android:name="com.google.android.actions"
        android:resource="@xml/actions" />
</application>

`

actions.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>


</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}/... -->
    <!-- Make sure that the authority matches with the one defined in AndroidManifest.xml -->

    <fulfillment
        fulfillmentMode="actions.fulfillment.SLICE"
        urlTemplate="content://com.devrel.android.appactions.slices.provider/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
            intentParameter="exerciseObservation.aboutExercise.name"
            required="true"
            urlParameter="exerciseType" />

    </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" />

</action>
`

@mmaSunshine
Copy link
Author

image

@mmaSunshine
Copy link
Author

@taycaldwell @skimarxall @adamkoch @dzuluaga
when I ensure the locale was en-US in my phone,the app is called normal via google assistant,
and now I wonder know if the sample can called via google assistant on android TV,when I test via AATT,the TV has a toast "no application can handle this action".but the Android TV support google assistant.or there have any difference between Google for Android TV and phone.
Thanks in advance!

@dzuluaga
Copy link
Contributor

dzuluaga commented Nov 7, 2019

Thanks for inquiring about App Actions on Android TV. App Actions are currently available on devices that run Google Search App. Stay tuned, will keep this thread posted.

@mmaSunshine
Copy link
Author

Thanks for inquiring about App Actions on Android TV. App Actions are currently available on devices that run Google Search App. Stay tuned, will keep this thread posted.

Thank you! Figure it out .I want to extend my app via google assistant on Android TV.Could you know there are other way to support it .

@dzuluaga
Copy link
Contributor

dzuluaga commented Nov 8, 2019

Not that I know of, sorry. But please raise the requirement through the public component. Thanks!

@Elshad1
Copy link

Elshad1 commented Jan 27, 2021

I have the same problem.
I tests via App Actions Test Tools the android TV has a toast "You don't have an app that can do this".

I also created an app for testing Custom Intents, everything works correctly, but the Google Assistant won't close. The assistant does not close with the back button, you have to press the home button and close the application together with the assistant.
What could be the problem?
actions.xml

<?xml version ="1.0" encoding ="utf-8"?>
<actions>
    <action
        intentName="custom.actions.intent.OPEN_APP_FEATURE"
        queryPatterns="@array/feature_queries">
        <parameter
            name="action"
            type="https://schema.org/Text" />
        <parameter
            name="text"
            type="https://schema.org/Text" />

        <fulfillment urlTemplate="https://safarov.page.link/open{?item_action,item_text}">
            <parameter-mapping
                intentParameter="action"
                urlParameter="item_action" />
            <parameter-mapping
                intentParameter="text"
                urlParameter="item_text" />
        </fulfillment>
    </action>
</actions>

AndroidManifest.xml

<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="safarov.page.link"
        android:scheme="https" />
</intent-filter>

@elloza
Copy link

elloza commented Sep 18, 2021

Same problem here with Android TV. Is there any plan for supporting app actions on Android TV? It would be a nice way to extend the access to application features...

I was able to get it working on a TV box with Android (not Android TV) but I think that this could be available in this OS too...

Thanks for the info!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants