1
現在我可以通過A2DP開始播放音頻併成功切換到SCO,但是當我嘗試切換時,它會通過手機揚聲器播放。Android 2.3:如何從SCO切換到支持藍牙音箱的A2DP?
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
layout = (RelativeLayout) findViewById(R.id.layout);
text = (TextView) findViewById(R.id.editText1);
scoSwitch = (ToggleButton) findViewById(R.id.switch1);
try {
mp1 = MediaPlayer.create(this, R.raw.jc_cm);
mp2 = MediaPlayer.create(this, R.raw.rp);
amanager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
//amanager.setBluetoothA2dpOn(true);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void onSCOswitch(View view){
if (scoSwitch.isChecked()){
amanager.setBluetoothScoOn(true);
amanager.startBluetoothSco();
Log.d("Bluetooth", "SCO on");
amanager.setMode(AudioManager.MODE_IN_COMMUNICATION);
}
else{
amanager.stopBluetoothSco();
amanager.setBluetoothScoOn(false);
amanager.setBluetoothA2dpOn(true);
Log.d("Bluetooth", "SCO off");
amanager.setMode(AudioManager.MODE_NORMAL);
}
}
一年後,這仍然是不可能的? – frankish
我可能會在接下來的幾周/幾個月內重新審視這個問題。如果我發現任何東西,我會更新這個線程。 – swooby