0

How to play an Audio clip that is stored in Phone Memory during the Phone call, and the same Audio clip should hear to Call receiver...

I am using simple code:

   public void onCallStateChanged(int state, String incomingNumber) {
    String stateString = "N/A";
    switch (state) {
    case TelephonyManager.CALL_STATE_IDLE:
      stateString = "Idle";
      break;
    case TelephonyManager.CALL_STATE_OFFHOOK:
      stateString = "Off Hook";
      break;
    case TelephonyManager.CALL_STATE_RINGING:
      stateString = "Ringing";
      break;

  } 

Really I don't know how to write code to play audio file automatically while receiver will pick my call only for a particular number.....

Vikas Gupta
  • 3
  • 1
  • 6

1 Answers1

0

There's no API in place in Android for playing audio over the voice call uplink. There may be phones out there that support it (I have not tested every single Android phone) but in general it's not going to work.
The best you could to is route the music to the loudspeaker, set the media volume to max and hope that it gets picked up by the microphone. That would sound awful though, so it's not something I'd recommend.

Michael
  • 57,169
  • 9
  • 80
  • 125