I am designing a prank app for android in which i want to show as if someone has called and then when the user answers the call it should play the recorded file. I have finished most of the things apart from 2 issues which i am facing currently.
1) When the user answers the calls the recorded file should be played through earpiece (currently its automatically playing it through speaker)
2) As we all know the UI of every phone is somewhat different when they get a call, so i want to make sure that when running the app it should use the phone’s default UI, so as to make sure it looks like a real incoming call.
Any help on the problem would be highly appreciated.
For the first part of your question: You should be able to get the same routing that a voice call gets if you use the VOICE_CALL stream type for your playback (i.e. earpiece of no accessories are attached, wired headset if one is attached, etc).
To get the same canny sound as a voice call you should make your audio files 8 kHz mono, preferably AMR-encoded.