相关疑难解决方法(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中启动语音识别:

PackageManager pm = getPackageManager();
List<ResolveInfo> activities = pm.queryIntentActivities(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);

if (activities.size() == 0) {
    displayWarning("This device does not support speech recognition");
    return;
}

Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);

startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);
Run Code Online (Sandbox Code Playgroud)

这很好用.但是,它似乎不接受来自使用"电话音频"配置文件配对和连接的蓝牙耳机的语音输入.

我可以使用名为SoundAbout的应用程序将"Media Audio"强制为"Bluetooth(mono)(SCO)".有了这个应用程序集,我的语音识别现在可以从我的耳机输入语音输入.

如何使用RecognizerIntent并从蓝牙耳机获取语音输入?

我在API级别16中看到有一个新的意图操作ACTION_VOICE_SEARCH_HANDS_FREE.这对我来说太新了,但这会解决我的问题吗?

我是否必须在AudioManager(就像我假设SoundAbout正在做)中使用setBluetoothScoOn()或startBluetoothSco()来路由音频输入?

android speech-recognition bluetooth

25
推荐指数
2
解决办法
3万
查看次数

没有弹出的Android语音识别应用程序

我目前正在寻找JAVA的职业生涯,并决定从构建应用程序开始.我在这里有这个代码,我用它来触发语音识别.

public class MainActivity extends Activity implements OnClickListener{

private static final int VR_REQUEST = 999;
private ListView wordList;
private final String LOG_TAG = "SpeechRepeatActivity";  
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button speechBtn = (Button) findViewById(R.id.speech_btn);
    wordList = (ListView) findViewById (R.id.word_list);
    PackageManager packManager= getPackageManager();
    List<ResolveInfo> intActivities = packManager.queryIntentActivities
                    (new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
    if (intActivities.size() !=0){
        speechBtn.setOnClickListener(this);
    } else {
        speechBtn.setEnabled(false);
        Toast.makeText(this,"Oops - Speech Recognition Not Supported!", 
                                             Toast.LENGTH_LONG).show();
        }       
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this …
Run Code Online (Sandbox Code Playgroud)

java android voice-recognition

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