是否可以扩展语音搜索应用程序?我知道我可以在自己的应用程序中添加一个按钮来启动语音识别对话框,但我想知道是否可以扩展当你长时间按下物理的“搜索”键时自动启动的语音搜索应用程序。
send text to [contact] [message]
listen to [artist/song/album]
call [business]
call [contact]
send email to [contact] [message]
go to [website]
note to self [note]
navigate to [location/business name]
directions to [location/business name]
map of [location]基本上,我想在上面的列表中添加我自己的操作。
这是可能的,还是我必须创建我自己的?
发布于 2010-11-22 02:53:06
简而言之,不是。该应用程序没有您正在寻找的扩展点。你将不得不完全编写自己的应用程序,这是其他人已经做过的事情。
发布于 2017-02-14 02:58:31
处理语音搜索的一种简单方法
第1步在单击按钮时调用此方法
public void startVoiceRecognition() {
Intent intent = new Intent("android.speech.action.RECOGNIZE_SPEECH");
intent.putExtra("android.speech.extra.LANGUAGE_MODEL", "free_form");
intent.putExtra("android.speech.extra.PROMPT", "Speak Now");
this.mContainerActivity.startActivityForResult(intent, 3012);
}步骤2覆盖onActivityResult方法
@ Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 3012 && resultCode == RESULT_OK) {
ArrayList < String > matches = data.getStringArrayListExtra("android.speech.extra.RESULTS");
String result= matches.get(0);
//Consume result
edittext.setText(result);
}
}这就是全部,完成
https://stackoverflow.com/questions/4056003
复制相似问题