1

How to play an audio clip in a call in android, as the official docs says media player class does not allow this from java api level.

I got to know that audioflinger library or ALSA can be used to do this or creating a virtual microphone. So kindly let me know what is the best approach..

Thanks

gauravsheohar
  • 396
  • 5
  • 12
  • The AudioFlinger doesn't modify voice call audio. It can be done by writing to the appropriate alsa controls **if** the platform supports it. But any such solution is probably going to be fairly platform-specific (i.e. will only work on some phones). This is a pretty advanced topic that will require some research and experimenting on your part. See e.g. http://stackoverflow.com/questions/15204570/inject-uplink-audio-in-call-with-snapdragon-msm8960-soc/15205455#15205455 and http://stackoverflow.com/questions/21024851/redirecting-audio-creating-alternate-sound-paths-in-android/21217919#21217919 – Michael Feb 05 '16 at 08:04
  • Thanks a lot Michael..I am actually going through some answering machine apps...so they are having permissions to access phone state,so do you have any idea how they can inject voice into audio call.. https://play.google.com/store/apps/details?id=com.mathalogic.autoanswer&hl=en – Chaitali Deb Feb 05 '16 at 12:15
  • I don't see anything in the description for the app you linked to that says that it can inject audio into the voice call uplink. Anyway, speculating about how some random app is working doesn't seem very meaningful. I know that it can be done on some devices, but I think you'd have a very hard time getting it to work on all/most devices. And I'm not counting enabling speakerphone mode and playing the message through the loudspeaker, because that's a really poor solution. – Michael Feb 05 '16 at 12:36
  • As per requirement I have to do it for some Motorola devices..but after modifying ALSA recompiling may be a problem...can you please suggest what approach to take for that... – Chaitali Deb Feb 08 '16 at 07:20
  • I've never worked with any Motorola devices, so I've no idea. You'd have to figure out what platform(s) the devices are based on, and which alsa controls those platforms provide, and continue from there. – Michael Feb 08 '16 at 07:25

0 Answers0