1
votes

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

1
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
@Prisoner done. ThanksSeb

1 Answers

0
votes

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.