In this mail, i want to tell us, how to add Bluetooth support into linphone for android. In my project, I have tested code on samsung galaxy tab 7.7"(p6800).
The changes are below.
boolean different = isSpeakerOn() ^ speakerOn;
if (!different) {
Log.d("Skipping change audio route by the same route ",
speakerOn ? "speaker" : "earpiece");
return;
}
//add below
if(mAudioManager.isBluetoothScoAvailableOffCall()){
mAudioManager.setBluetoothScoOn(true);
mAudioManager.setBluetoothA2dpOn(speakerOn);
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
mAudioManager.startBluetoothSco();
return;
}else{
if (Hacks.needGalaxySAudioHack() || sLPref.useGalaxySHack())
setAudioModeIncallForGalaxyS();
if (sLPref.useSpecificAudioModeHack() != -1)
mAudioManager.setMode(sLPref.useSpecificAudioModeHack());
if (Hacks.needRoutingAPI() || sLPref.useAudioRoutingAPIHack()) {
mAudioManager.setRouting(
MODE_NORMAL,
speakerOn? ROUTE_SPEAKER : ROUTE_EARPIECE,
AudioManager.ROUTE_ALL);
} else {
mAudioManager.setSpeakerphoneOn(speakerOn);
}
for (LinphoneOnAudioChangedListener listener : getSimpleListeners(LinphoneOnAudioChangedListener.class)) {
listener.onAudioStateChanged(speakerOn ? AudioState.SPEAKER : AudioState.EARPIECE);
}
}
}
Then Bluetooth headset can be used.
Mic is hearing low by receiver.But, it may be caused by device.