I am unable to successfully use the Google System Voice Actions "Search in App" (com.google.android.gms.actions.SEARCH_ACTION
) on an app that I have already published onto Google Play (Private Channel) and downloaded onto my phone.
The intent with the query extra from the search action is to be passed on to MainActivity
after matching the intent filter.
Before publishing the app, I have already tested the app using the adb
command below which works perfectly:
adb shell am start -a "com.google.android.gms.actions.SEARCH_ACTION" --es query "[query]" -n "com.testapp/.MainActivity"
Below is my Android manifest which contains the intent filters:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.testapp" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".app.AppController"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:allowTaskReparenting="true">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:exported="true"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.VOICE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.VOICE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.VOICE" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
<meta-data
android:name="android.app.default_searchable"
android:value=".MainActivity" />
</activity>
</application>
</manifest>
Are my intent filters required for Google Voice Actions set up correctly, and if so, why did using Google App to search for keywords within my app not work? Or are there any other considerations such as (some personal guesses only): time needed for Google App to "cache/process" app contents/intent filters etc., the app name and search keywords not being "unique" enough, or the fact that the app being distributed onto a Private Channel instead?
Hoping for anyone who has successfully implemented Google Voice Actions before to share and provide some input.
I have found the answer from this blogpost which states the following:
Voice Actions that use your specific app name require you to have the app placed publicly in the app store so the name can get indexed by Google.
which, if accurate, would imply that Google will need time to associate the name of the app for the command "search for [keyword] in [app name]" to be successful, even after the app has been published. This would be more effective if the app is public and not in a Google Play private channel.
来源:https://stackoverflow.com/questions/35737095/app-already-published-onto-google-play-but-unable-to-use-google-voice-actions