You can do that but using external API, check how keyword activation is implemented in pocketsphinx
ok Google-like hotword listener
题
I'm currently programming a search engine application and would like to let the app listen to a hotword when I'm in the app, like Google with "Ok Google". How can I let the app listen for that and how can I let it start a certain function?
To be exact, this function:
btnSpeak.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(
RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "de-DE");
try {
startActivityForResult(intent, RESULT_SPEECH);
txtText.setText("");
} catch (ActivityNotFoundException a) {
Toast t = Toast.makeText(getApplicationContext(),
"Ihr Gerät unterstützt kein Sprache-Zu-Text-System!",
Toast.LENGTH_SHORT);
t.show();
}
}
});
Thanks for your help!
解决方案
不隶属于 StackOverflow