Java Android蓝牙耳机只工作一次
下午好。我的一个朋友向我求助他的Android应用程序。当按下蓝牙耳机上的按钮时,他正试图让蓝牙耳机接收他的声音 该应用程序运行良好,按下按钮后,它会正确地拾取声音。然而,当他按下按钮时,在一次初始成功后,什么也没有发生。他的密码是:Java Android蓝牙耳机只工作一次,java,android,mobile,bluetooth,headset,Java,Android,Mobile,Bluetooth,Headset,下午好。我的一个朋友向我求助他的Android应用程序。当按下蓝牙耳机上的按钮时,他正试图让蓝牙耳机接收他的声音 该应用程序运行良好,按下按钮后,它会正确地拾取声音。然而,当他按下按钮时,在一次初始成功后,什么也没有发生。他的密码是: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mBluetoothAdapter.getProfileProxy(this, mHeadsetProfileListener, BluetoothProfile.HEADSET);
Intent reconocimientovoz=new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
reconocimientovoz.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
reconocimientovoz.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,1);
reconocimientovoz.putExtra(RecognizerIntent.EXTRA_PROMPT, "Escuchando");
startActivityForResult(reconocimientovoz, REQUEST_CODE);
}
他说,如果他删除以下行:
mBluetoothAdapter.getProfileProxy(this, mHeadsetProfileListener, BluetoothProfile.HEADSET);
该应用程序工作正常,但显然它使用的是手机麦克风而不是耳机麦克风
我以前从未使用过蓝牙,所以老实说,我一点也不知道出了什么问题。有人介意把我们推向正确的方向吗
非常感谢您的任何帮助