I am beginner in android development and felt like google documentation is not able to help me out. So if anyone knows whether it is possible to send an audio file directly to uplink in between a call? Also share how incase it is possible.
Asked
Active
Viewed 1,721 times
0
-
1AFAIK it is not possible with the publicly available APIs – FoamyGuy Feb 19 '13 at 14:36
-
can it be made possible through NDK? – Mach Mitch Feb 19 '13 at 14:38
-
No, not to my knowledge. The NDK is part of the publicly available APIs... – FoamyGuy Feb 19 '13 at 14:41
-
@FoamyGuy Appreciate your input – Mach Mitch Feb 19 '13 at 15:30
-
This probably won't help you, but maybe you can use the twillio API to achieve the functionality you are after: http://www.twilio.com/ – Bjorn Roche Feb 19 '13 at 15:55
-
Twilo is restricted to a few countries. But thank you for suggestion. – Mach Mitch Feb 19 '13 at 20:46
1 Answers
5
There are no Android APIs that allow you to access, read or write to the audio stream in a call. If any manufacturer provides these APIs, I am not aware of them.
The reason for this is that, at least for AOSP Android, the call part of the device is handled on a hardware level, and not much control is available to Android itself.
It is not possible via the NDK either. The only way you'd have a chance of achieving this is if you were to modify and build Android directly from source.

Raghav Sood
- 81,899
- 22
- 187
- 195
-
AudioTrack track = new AudioTrack(AudioManager.STREAM_VOICE_CALL, mySampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, myBuffersize, AudioTrack.MODE_STREAM); – Mach Mitch Feb 19 '13 at 14:45
-
@MachMitch That is not part of the public API. AudioTrack has no public constructor. You must get it via getSystemService(). This code will not work in an app. – Raghav Sood Feb 19 '13 at 15:02
-
Thank you for the input @Raghav Sood , but can you take a look at the code provided in this link [link] http://stackoverflow.com/questions/6395846/trigger-an-audio-file-when-call-is-answered?rq=1 [/link] Let me know if it would work otherwise i will have to drop my project. – Mach Mitch Feb 19 '13 at 15:25
-
1@MachMitch That question is to play audio over the loudspeaker, not over the call. – Raghav Sood Feb 19 '13 at 15:29
-
-
@RaghavSood: You say AudioTrack does not have a public constructor but according to the docs it very much does. "http://developer.android.com/reference/android/media/AudioTrack.html#AudioTrack(int, int, int, int, int, int, int)" So I'm very confused as to why you say it must be got via getSystemService ... – Goz Jan 17 '14 at 10:25