Bonjour à tous.
Dans mon application je récupère les informations de "OK Google" pour faire une recherche dans mon application:
Dans l'activité de mon manifest j'ai donc:
1 2 3 4 5
| <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.VOICE" />
</intent-filter> |
et dans mon application:
1 2 3 4 5 6 7
| Intent intent = getIntent();
if (SearchIntents.ACTION_SEARCH.equals(intent.getAction())){
String query = intent.getStringExtra(SearchManager.QUERY);
Log.e("", "query =" + query);
Toast.makeText(getBaseContext(), "Action: "+query, Toast.LENGTH_LONG).show();
CheckVocal(query);
} |
J'ai publié mon application sur le store pour que Google Now se mette en relation avec mon application.
J'ai 2 problèmes:
1 - Lorsque je dis: OK Google, recherche la dernière moto sur "Mon app", la recherche se fait sur internet et non sur mon application.
2 - Lorsque je dis: OK Google, recherche le dernier prix sur "Mon app", la recherche se fait bien sur "Mon app", mais le
intent.getStringExtra(SearchManager.QUERY)
est en anglais et mon String query = "the last price" et non "le dernier prix".
J'aimerai avoir vos avis pour pouvoir faire fonctionner cette fonction convenablement et avoir le résultat en Francais...
Merci d'avance!
Partager