是否可以在您自己的应用程序中使用"google now"这种酷炫的语音激活功能?
所以我想要的是用户不必通过按下按钮或某事来触发激活.像那样.
我更喜欢通过关键字激活自动语音识别.例如:当"google now"打开时,您只需说:"google".在该命令之后,系统正在监听实际输入.
这可以通过使用android API吗?或者是否有任何提供此行为的开源库?
我知道这可能是"开放的耳朵",但不幸的是开放耳朵不适用于Android.
我正在尝试将Android语音识别作为服务运行.我可以验证服务的onCreate()和onStart()方法是否被调用,但是没有调用语音识别方法的回调,尽管我已经正确设置了SpeechRecognizer对象.语音识别似乎在活动而不是服务中完成.如何使其作为服务工作?这是一个明显的问题吗?
package net.viralpatel.android.speechtotextdemo;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import android.app.Service;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.speech.RecognitionListener;
import android.speech.RecognizerIntent;
import android.speech.SpeechRecognizer;
import android.util.Log;
import android.widget.Toast;
public class MyService extends Service implements RecognitionListener {
private SpeechRecognizer speechRecognizer;
@Override
public IBinder onBind(Intent arg0) {
return null;
}
@Override
public void onCreate() {
Toast.makeText(this, "My Service Created", Toast.LENGTH_LONG).show();
Log.d("tag", "onCreate");
speechRecognizer = SpeechRecognizer.createSpeechRecognizer(getApplicationContext());
speechRecognizer.setRecognitionListener(this);
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
speechRecognizer.startListening(intent);
}
@Override
public void onDestroy() {
Toast.makeText(this, …Run Code Online (Sandbox Code Playgroud) 我有一个应用程序,继续听取语音并使用Google Voice API将其转换为命令.
我一直用它setStreamMute(AudioManager.STREAM_SYSTEM, true)来静音,直到几天前"谷歌搜索"新的更新之前它一直工作.有没有解决方法?
我知道我可以使用setRingerMode(AudioManager.RINGER_MODE_SILENT),但也许有另一种方法?
我使用语音识别和文本到语音,但我想静音语音识别的"嘟嘟"声,然后取消静音,听听声乐合成.
我成功静音但是当我想将音量设置为最大值时,它适用于手机而不是我的应用程序.
如何管理?
谢谢
我正在使用Android API的语音识别功能.
我成功地遵循了本教程:http: //code4reference.com/2012/07/tutorial-android-voice-recognition/#comment-335
但我还有一个未解决的问题.
我是如何删除调用RecognizerIntent时出现的屏幕?
我正在谈论删除谷歌和麦克风按钮,建议我使用语音识别.
我需要删除这个小屏幕,因为我需要在屏幕上做其他事情,同时识别我的声音.