相关疑难解决方法(0)

Android语音识别作为Android 4.1和4.2上的服务

我已经成功地将连续语音识别工作(使用SpeechRecognizer类)作为服务,适用于4.1以上的所有Android版本.我的问题是关于让它在版本4.1和4.2上运行,因为众所周知,有一个问题是,API没有按照文档识别启动后几秒钟的记录,如果没有检测到语音输入那么它就像如果语音识别器无声地死亡.(http://code.google.com/p/android/issues/detail?id=37883)

我找到了一个问题,提出解决这个问题的方法(语音识别在几秒钟后停止监听),但我不确定如何实现此解决方案所需的处理程序.我知道这种解决方法每隔几秒钟会发生一次"嘟嘟"声,但对我来说,获得连续的语音识别更为重要.

如果有人有任何其他替代解决方法,那么我也想听听.

android speech-recognition android-4.2-jelly-bean

53
推荐指数
4
解决办法
6万
查看次数

Android语音识别连续服务

我正在尝试创建一个在Android 4.2中运行连续语音识别的服务.使用此链接的答案(Android 4.1和4.2上的Android语音识别作为服务),我创建了一个从Activity运行的服务.我的问题是我在访问mTarget.mAudioManagermTarget.mSpeechRecognizerIntent在handleMessage方法中获得null异常.目标(以及从中创建的mTarget对象)不是null,而是其中的所有对象.

我在这做错了什么?

相关活动代码(从activity调用的静态方法,activityContext是调用此方法的活动):

public static void init(Context context)
{
   voiceCommandService = new VoiceCommandService();
   activityContext = context;
}

public static void startContinuousListening()
{
    Intent service = new Intent(activityContext, VoiceCommandService.class);
    activityContext.startService(service);

    Message msg = new Message();
    msg.what = VoiceCommandService.MSG_RECOGNIZER_START_LISTENING; 

    try
    {
      voiceCommandService.mServerMessenger.send(msg);
    } 
    catch (RemoteException e)
   {
    e.printStackTrace();
   }

}
Run Code Online (Sandbox Code Playgroud)

服务代码:

public class VoiceCommandService extends Service
{
protected AudioManager mAudioManager; 
protected SpeechRecognizer mSpeechRecognizer;
protected Intent mSpeechRecognizerIntent;
protected final Messenger mServerMessenger = new …
Run Code Online (Sandbox Code Playgroud)

service android speech-recognition

22
推荐指数
1
解决办法
3万
查看次数

错误ERROR_RECOGNIZER_BUSY具有离线语音识别功能

我对谷歌离线语音识别进行了研究.但它在谷歌nexus 5(操作系统:-4.4)工作正常,但如果我在三星galaxy s5(操作系统:-5.0)实现相同的构建,它无法识别,它显示此错误:

8- ERROR_RECOGNIZER_BUSY.

以下是我的代码.通过保持此链接作为参考,我做了一些更改http://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/

没有互联网语音必须承认.我曾经在Pocket sphinx上工作,但它需要大量的侧面声音,因此客户拒绝了它.

public class VoiceRecognitionActivity extends Activity implements RecognitionListener {

    private TextView returnedText;
    private static ProgressBar progressBar;
    private static SpeechRecognizer speech = null;
    private static Intent recognizerIntent;
    private String LOG_TAG = "VoiceRecognitionActivity";
    private Button button1;
    Activity activity = VoiceRecognitionActivity.this;
    private TextView textView2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        returnedText = (TextView) findViewById(R.id.textView1);
        textView2 = (TextView) findViewById(R.id.textView2);
        progressBar = (ProgressBar) findViewById(R.id.progressBar1);
        button1 = (Button) findViewById(R.id.button1);

         getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    //  toggleButton = (ToggleButton) findViewById(R.id.toggleButton1);

         PackageManager …
Run Code Online (Sandbox Code Playgroud)

android speech-recognition speech-to-text android-intent google-voice-search

11
推荐指数
1
解决办法
3723
查看次数

如果没有立即说话,JellyBean中的RecognitionListener会冻结

我正在开发的基于语音识别的应用程序适用于从API 8(Android 2.2)开始的所有Android版本.

但是在Nexus S 4G(Android 4.1.1)上,RecognitionListener将暂停大约1分钟,然后通过其onError()回调发出ERROR_SERVER .

如果在1-2秒内(在onReadyForSpeech上发出哔哔声)说话,它将按预期正常运行.

在JellyBean中有什么变化可以解释这种行为?

更重要的是,是否有一种方法可以使其在旧版本的Android中表现得像?(即继续听,如果没有在默认的10秒内说出,则发出ERROR_SPEECH_TIMEOUT )

android speech-recognition android-4.2-jelly-bean

9
推荐指数
1
解决办法
1138
查看次数