3

I want to play music from android phone when some one receives a call. I am able to play music but other side can not listen that music. How can I make other side to listen to music(what should be the coding so that music playback can be inserted into mic for other side to hear)?

I am getting mixed suggestion regarding this feature.check here it is possible

AndroidDev
  • 2,627
  • 6
  • 29
  • 41

2 Answers2

2

If you're still curious, the reason you cannot play to the other side is that Android's hardware usually doesn't interconnect the actual GSM call stream with any part of software stack that can be used to modify it; what it does is mirroring actual call data (microphone/speaker) to software after it's been sent to line (allowing a little control like setting microphone mute, sending DTMFs and hanging the call).

The exact sound routing is done in phone chip, so no control over it can be achieved; more to say, Bluetooth audio streams are decoded and mirrored in chip (this technology is called DAIBT for direct audio interface), and this effectively works for latency and power effeciency.


Some vendors (currently known: Qualcomm) are providing vendor-specific way to inject audio into GSM call uplink on certain chipsets (MSM8960, APQ8064) - refer to this answer: https://stackoverflow.com/a/15205455/438039;

Community
  • 1
  • 1
kagali-san
  • 2,964
  • 7
  • 48
  • 87
0

I am using HTC device and it was not possible to achieve the above functionality in this device. This setting varies according to manufacturer. My code might play sound to the listener side in some other manufacturer phones.

AndroidDev
  • 2,627
  • 6
  • 29
  • 41
  • I dont have code at present. May be you can write code on your own. Receive intent of phone pick up and start playing a sound file. On the time of this question my code was working properly on emulator. But it was not working on a device. Try it you side its a very simple code, listen an intent and play a sound file thats it. – AndroidDev Dec 26 '14 at 06:17
  • "listen an intent" can share a link where to read about it so I can understand what is at stake? – Valera Valerianov Dec 26 '14 at 06:25