0

I am building an app which plays background music during incoming call.

It works fine when i get an incoming call it starts music on external speaker but when i answered call I have setSpeakerphoneOn(true) that plays music and caller voice on external speaker but mic doesn't pick up that playing sound it only picks up my voice .

Where am I wrong I don't know .Anyone knows please let me know.I would be thankful.

m_audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
Log.d("Is phone speaker : ","IDLE-1-->"+ m_audioManager.isSpeakerphoneOn());
m_audioManager.setMode(AudioManager.MODE_IN_CALL);    
m_audioManager.setSpeakerphoneOn(true); 
RecieverDialog.mp.start();
Zombie
  • 1,965
  • 2
  • 20
  • 34
Naresh29
  • 49
  • 9

1 Answers1

0

Any audio recorded by playing it in the phone's loudspeaker and recording it through the phone's microphone will be of poor quality since phone loudspeakers typically aren't very good, and you're very rarely in a noise-free, anechoic environment.

As for why the music gets muted or heavily attenuated in your use-case: your phone might be doing noise suppression with two (or more) microphones, where the signal coming from one microphone could be used as a sort of reference for the noise in your surrounding environment.
The goal of the algorithm is to remove all surrounding noise so that the person at the other end of the call only hears your voice. Depending on the placements of the microphones and the tuning of the algorithm, the music you're playing might be considered to be noise and therefor suppressed in the uplink signal.

Michael
  • 57,169
  • 9
  • 80
  • 125