I want to develop an app which play background music for a call,and is audible only for the caller and listener. Is there any application which is already available,Is it possible in android?
-
1No, android apps can't interfere with the call data. Best you can do is play it over the speaker and hope it picks up, but phone calls use an audio codec which is not friendly to music. – Gabe Sechan Jan 21 '13 at 04:31
-
Sorry, its not. Not unless you're selling phones. If you are, you could edit Android itself to make it possible. But apps don't have the capability. – Gabe Sechan Jan 21 '13 at 04:37
-
1Seems like a real question, at least now.. – nsandersen Apr 13 '19 at 13:37
2 Answers
Some mobile platforms do support this functionality at the platform-level (e.g. I've tested this with the Qualcomm APQ8064 where I had configured the hardware codec route accordingly, and it works). But Android doesn't have an API that let's you use this as an app developer, so on a non-rooted phone there's not really anything you can do.
Why there's no API for it - or whether there will be one in coming versions of Android - I don't know. There might be legal issues in some markets, or it might just be because it's considered as a semi-obscure feature that they don't see a great demand for and which is supported only by a relatively small number of platforms.
Another thing to consider is, do you really want to have music playing in the background during a call?
The audio is going to be 8 kHz mono (or 16 kHz mono if you're in a wideband call), and it's going to be AMR-encoded along with the rest of the speech signal (AMR is a low-bitrate codec designed for encoding speech). In other words, any music you play over the voice call uplink is going to sound really, really bad.
UPDATE: For APQ8064-based phones where you have root access, the procedure would be something like this (I don't remember the exact syntax off the top of my head):
audioManager.setParameters("incall_music_enabled=true");
// Execute the following using e.g. Runtime.exec()
amix 'SLIMBUS_4_RX Audio Mixer MultiMedia2' 1
aplay -Dhw:0,1 mono_8khz_data.pcm
// When you want to stop music playback, stop the aplay process, and then do
audioManager.setParameters("incall_music_enabled=false");

- 57,169
- 9
- 80
- 125
-
2There is a link in google play who doing the same thing....https://play.google.com/store/apps/details?id=org.jefferyemanuel.phonemusic – Geethu Jan 21 '13 at 07:17
-
That app's description says "on some Samsung and new Sony Ericsson phones." and "On most phones you cant share the audio." – Michael Jan 21 '13 at 07:20
-
-
I'm not familiar with Samsung's phones or platforms so I can't answer for that. For the Qualcomm APQ8064 platform (used e.g. on LG Optimus G, Sony XPeria Z/ZL and some other phones) where you have root access, see the update in my answer. If you don't have root access then I have no idea how you'd do this. The default behaviour on all phones that I've worked on is to mix music playback into the downlink during calls; i.e. you can hear the music but the other party can't. – Michael Jan 21 '13 at 07:48
-
@Michael do you have time to check? http://stackoverflow.com/questions/21024851/redirecting-audio-creating-alternate-sound-paths-in-android – nLL May 16 '16 at 21:03
-
@Michael Hello Mike, I am having a similar requirement. My requirement is for personal testing purpose. My app wont go to play store. I can change AOSP code, build and run to the device. You can also tell me which device to use, I would get the same device and rooted as well. I need to inject stored audio file into MIC. I would be making a VoIP call and inject the audio file as input to MIC. So that i can test the audio quality of received audio at the other end, over the network. My requirement is to test audio quality. Once VoIP call is setup, the only input to the MIC is my audio file. – DJphy Dec 15 '19 at 16:17
-
@Michael Do you know what parameters should I use for implementing recording calls? I want to implement a call recording feature on rooted devices. I want to implement the feature with using sound driver – Fahime Ghasemi Aug 01 '22 at 08:04
currently there is no way to do this as the hardware does not support it.

- 54,068
- 14
- 92
- 112
-
-
1yes. you can not send music over uplink. neither os nor the hardwars supports it. You can try to play music at loudspeaker. Although I am not sure about the later one. – stinepike Jan 21 '13 at 05:07
-
1The hardware is capable, no matter the manufacturer. Its the software that may or may not limit. – Nick Mar 22 '15 at 22:09