0

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.

frogatto
  • 28,539
  • 11
  • 83
  • 129
Mach Mitch
  • 313
  • 3
  • 7
  • 17

1 Answers1

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
  • Thank you @Raghav Sood for helping me out. Have a nice day. – Mach Mitch Feb 19 '13 at 15:40
  • @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