アプリに Google アシスタントのアクションを追加しようとしています。App Actions テスト ツールを実行すると、以下のエラーが表示され続け、何をすべきかわかりません。
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'
アクション.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>
Google が例として提供するフィットネス アプリに従いましたが、失敗します。
aab ファイルを生成し、リリース管理の内部チャンネルにアップロードしました。私はすでにアプリを運用しており、この新しいアプリには同じ pkg 名を使用しています。
また、これらのインテントを DialogFlow および Actions コンソールに追加しました。クラウドでテストし、デバイスで Google アシスタントを使用すると、フローは機能します。GA はダイアログ フローを認識しますが、アプリでは何も起こりません。スライスやディープリンクはありません。ログを追加しましたが、ログが表示されません。以下の初期化のみが機能します。
@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
}
私のマニフェストには以下が含まれます:
<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>
悪意のある名前について不平を言い続ける理由、または私が求めるアクションに反応しない理由はありますか?
アプリがアクションを受信したかどうかを確認する手がかりがありません。私は意図を期待されていましたが、何もありませんでした。アクション ツールで既にエラーが発生しているため、actions.xml が期待どおりに動作することは期待できないと思います。
ご協力いただきありがとうございます