1

I am working to add Google Assistant actions in my app. When running the App Actions test tool, the error below keep poping-up and I do not know what to do.

App Actions Test Tool v3.1.5
                Preview Creation Error
                Status Code: 400
                Message: Precondition check failed.
                - Invalid intent name 'actions.intent.CHANGE_MY_SHIPMENT_DATE_BY_DATE'
                - Invalid intent name 'actions.intent.CHANGE_MY_SHIPMENT_DATE_BY_DURATION'
                - Invalid intent name 'actions.intent.CHANGE_MY_FREQUENCY'
                - Invalid intent name 'actions.intent.ADD_FLOW'
                - Invalid intent name 'actions.intent.ADD_TO_SUBSCRIPTION'
                - Invalid intent name 'actions.intent.REMOVE_FLOW'
                - Invalid intent name 'actions.intent.SNOOZE'
                - Invalid intent name 'actions.intent.CUSTOMER_SERVICE'
                - A parameter mapping is missing for the URL parameter 'box' in URL template 'content://com.xxyz.app.slices.provider/remove_flow{?product,box}' for intent 'actions.intent.REMOVE_FLOW'

actions.xml

<actions>
    <action intentName="actions.intent.CHANGE_MY_SHIPMENT_DATE_BY_DATE">
        <fulfillment
            fulfillmentMode="actions.fulfillment.SLICE"
            urlTemplate="content://com.xyz.app.slices.provider/change_shipment_by_date{?datetime}">
            <parameter-mapping
                intentParameter="datetimeType"
                required="false"
                urlParameter="datetime" />
        </fulfillment>
    </action>
...
 <action intentName="actions.intent.CUSTOMER_SERVICE">
        <fulfillment urlTemplate="https://xyz-app.firebaseapp.com/customer_service"/>
    </action>
</actions>

I have followed the fitness app that google provide as example but it fails.

I have generated a aab file and uploaded it on the internal channel of the release management. I already have an app in production and I kept the same pkg name for this new app.

Also, I have added those intents in the DialogFlow and Actions console. The flow is working when testing on the cloud and also using the Google Assistant on my device. The GA recognise the dialog flow but nothing happened in the app. No slices or deeplink. I have added logs and none of the logs shows. Only the init below works:

@RequiresApi(Build.VERSION_CODES.P)
  private fun grantAssistantPermissions() {
    Timber.e(" [VOICEASSISTANT] grantAssistantPermissions")

    getAssistantPackage()?.let { assistantPackage ->
      val sliceProviderUri = Uri.Builder()
          .scheme(ContentResolver.SCHEME_CONTENT)
          .authority(SLICE_AUTHORITY)
          .build()

      SliceManager.getInstance(this).grantSlicePermission(assistantPackage, sliceProviderUri)
    }
  }

  @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
  private fun getAssistantPackage(): String? {
    val resolveInfoList = packageManager?.queryIntentServices(
        Intent(VoiceInteractionService.SERVICE_INTERFACE), 0
    )
    return resolveInfoList?.firstOrNull()?.serviceInfo?.packageName
  }

My manifest contain:

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

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

...

        <!-- 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="xyz-app.firebaseapp.com"
                android:scheme="https" />
        </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>

Any idea why it keep complaining about bad intent name or even not react to any actions I ask ?

I have no clue to check if the actions is received by the app. I was expected an intent but nothing. As actions tool already raise errors, I assume that I can not expect the actions.xml to work as expected

Thanks for your help

Seb
  • 2,929
  • 4
  • 30
  • 73
  • Can you update your question to include the context of the actions.xml file, please? And can you clarify what you mean by "Assusming that the actions.xml file already raise issue, it may block the overall process" – Prisoner Mar 30 '20 at 23:02
  • @Prisoner done. Thanks – Seb Mar 31 '20 at 04:56

1 Answers1

0

App Actions and slices only work with the built-in Intents that are available for App Actions. They aren't available for custom conversational actions or conversational actions built using Dialogflow.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • So if I use a custom intent as I defined in my actions.xml, it will not work but it will work if I use an already built-in intent. So I need to use a built-in one or find something close to being able to use it. I am kind of lost here, Why are they offering to create intent in that case ? – Seb Mar 31 '20 at 15:36
  • To make sure I answer clearly, where are they "offering to create an intent"? (A URL that points to documentation or where they said this exactly would be best to make sure I see what Google says.) – Prisoner Mar 31 '20 at 15:59