Голосовой поиск Google Now с неопубликованным приложением
Я пытаюсь интегрировать голосовой поиск с моим приложением, чтобы моя SearchActiviity (это не моя деятельность по запуску). Для этого я уже сделал следующие шаги:
AndroidManifest.xml
<activity
android:name=".ui.product.VoiceProductSearchActivity"
android:label="@string/title_activity_product_list"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="com.google.android.gms.anctions.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>
searchable.xml
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:hint="@string/search_hint"
android:includeInGlobalSearch="true"
android:label="@string/app_name"
android:searchSuggestAuthority="dictionary" />
VoiceProductSearchActivity.java
public class VoiceProductSearchActivity extends BaseActivity {
private static final String ACTION_VOICE_SEARCH = "com.google.android.gms.actions.SEARCH_ACTION";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_voice_product_search);
if (getIntent() != null)
handleVoiceSearch(getIntent());
else{
........
}
}
private void handleVoiceSearch(Intent intent) {
if (intent != null && ACTION_VOICE_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
Log.d("voice query", query);
Toast.makeText(this, query, Toast.LENGTH_LONG).show();
...............
................
}
}
}
Теперь я попытался проверить функциональность с помощью команды adb, например:
adb shell am start -a com.google.android.gms.actions.SEARCH_ACTION \ --es query "Jackets" com.ecomm.app
adb shell am start -a com.google.android.gms.actions.SEARCH_ACTION -e query "Jackets" com.ecomm.app
Каждый раз, когда он возвращается с ошибкой:
Activity not started, unable to resolve Intent { act=com.google.android.gms.actions.SEARCH_ACTION flg=0x10000000 pkg=\ }
Я что-то пропустил в коде или есть какая-то проблема в команде ADB? Пожалуйста помоги.