The voice is not switching form bluetooth to earpiece for the first time during ongoing call

80 Views Asked by At

During the call, initially audio will route to Bluetooth headphone, when user tries to change the audio path from Bluetooth to earpiece for the first time it's not switching to the earpiece mode. When we try again, second time it was working fine. The voice switching is happening from Bluetooth to earpiece.

The issue is occurring only in android 10 and below devices not in android 11 and above. Why we are not able to switch? We are not facing any problem when we switch from Bluetooth to speaker mode.

​[Devices]

  • Device with Android 10 OS

[Precondition]

  • Already paired with a Bluetooth device

[Procedure to reproduce]

  1. Launch the mobile phone app and log in

  2. Receive an incoming call and transition to the calling screen

  3. Current audio path is Bluetooth

  4. Tap the voice switching button and choose an earpiece from the options

  5. Current audio path is still Bluetooth (not switched to earpiece)

We have posted this question in below link :
https://support.google.com/android/thread/213120745?hl=en&sjid=12297032522200724601-AP

we are using the following code. “SetEarPieceOn” method is used for switching audio to earpiece.

private AudioManager \_audioManager;

public AudioManagerService() 
{ 
    _audioManager = (AudioManager)Application.Context.GetSystemService(Android.Content.Context.AudioService);
    _audioManager.SpeakerphoneOn = false; 
    _audioManager.BluetoothScoOn = false; 
    _audioManager.StopBluetoothSco(); 
}   

public bool SetEarPieceOn() 
{       
    _audioManager.StopBluetoothSco(); 
    _audioManager.BluetoothScoOn = false; 
    _audioManager.SpeakerphoneOn = false; 
    return !_audioManager.SpeakerphoneOn; 
}

We have had added additional code that will switch audio to speaker and then earpiece immediately. Using this workaround, we can able to fix this issue.
But it is not a correct way.

Following is the updated fix code.

public bool SetEarPieceOn() 
{ 
    if (AppRes.OSVersion <= 10) 
    { 
    _audioManager.SpeakerphoneOn = true; //Added here due to switch to earpiece is not working for the first time when the call is connected with BT headset. 
    } 
    _audioManager.StopBluetoothSco(); 
    _audioManager.BluetoothScoOn = false; 
    _audioManager.SpeakerphoneOn = false; 
    return !_audioManager.SpeakerphoneOn; 
}

We have checked in multiple bluetooth devices still issue is occurring. So we don't think its an issue with bluetooth devices.

0

There are 0 best solutions below