RadZaeem
RadZaeem

Reputation: 311

Playing audio file into the call android

Say I make a call to someone with my android phone. Is it possible to play some audio file into the call?

Upvotes: 3

Views: 687

Answers (2)

tvshajeer
tvshajeer

Reputation: 1329

I just tried like this

if(state==TelephonyManager.CALL_STATE_OFFHOOK){
      AudioManager am = (AudioManager) pccontext.getSystemService(Context.AUDIO_SERVICE);  
      am.setMode(AudioManager.MODE_NORMAL); 
      am.setSpeakerphoneOn(true);
      MediaPlayer mp = MediaPlayer.create(pccontext, R.raw.beep);
      mp.start();
}

But its not working in MODE_NORMAL. When I tried with MODE_IN_CALL phone is playing the audio but caller on the other side is not able to listen the audio played by the receiver phone.

Upvotes: 1

Chris
Chris

Reputation: 326

Unfortunately, it is not possible, it is an Android security limitation.

Upvotes: 0

Related Questions