I have integrated voice search from ok google using below. AndroidManifest Entry :
<activity
android:name=".ExposedSearchActivity"
android:launchMode="singleTask">
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
in ExposedSearchActivity - onCreate()
if (intent != null && intent.hasExtra(SearchManager.QUERY)) {
String search = intent.getStringExtra(SearchManager.QUERY);
Log.wtf("", "q=" + search);
}
I have published the app in closed alpha on playstore. Still Activity is not getting opened from ok google. I have tried voice command like 'ok google search for salad in MyApp' or 'search for salad in MyApp'.
Although from adb it is getting opened by command as below .
adb shell am start -a com.google.android.gms.actions.SEARCH_ACTION -e query "salad" com.abc.MyAppp
Its been 2 days when i published my app but still from google assistant or ok google voice search is not opening MyApp.