How can I record voice and record Call in Android? [closed]

空扰寡人 提交于 2019-11-27 17:18:00
Abhijit Chakra

Yes It is possible just do this

final MediaRecorder callrecorder = new MediaRecorder();
callrecorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
callrecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
callrecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

callrecorder.setOutputFile(filepath);

try {
    callrecorder.prepare();
} catch (IllegalStateException e) {
    System.out.println("An IllegalStateException has occured in prepare!");
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {

    //throwing I/O Exception
    System.out.println("An IOException has occured in prepare!");
    // TODO Auto-generated catch block
    e.printStackTrace();
}

try {
    callrecorder.start();
} catch(IllegalStateException e) {
    e.printStackTrace();
    //Here it is thorowing illegal State exception
    System.out.println("An IllegalStateException has occured in start!");
}

for stopping you can use

callrecoder.stop();

Check this out...

http://androidforums.com/android-lounge/181663-android-phone-call-recording-function.html

The short answer is... Get a Galaxy S, preferably the South Korean version.

As far as I know, all the applications that record voice calls on Android have the same problem: they only work on some phones, while on other phones you can only hear one side of the conversation. Some of these apps try to solve this problem by recording from the microphone as well.

If you have root permissions on your Android phone, then I believe there are apps that work better because they have access to the lower level streams, as Emmanuel specified in his answer.

You can't record a phone conversation on Android. The streams are in the lower level operating system and are not accessible in the application level. Sorry.

I dont know if its possible but as far as API goes

recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);

this line compiles well in my code where recorder is an Object of MediaRecorder and I was once working on such project but later the project was dumped so not sure if it works or not

john

The API is apparently there, but makers have disabled their radio firmware from being able to do this.

Depends on phone to phone e.g. You cannot record a call on nexus and motorola phones as they do not allow recording from mic till the call is on going. But the same recording from mic while on call works on most samsung and galaxy devices.

I am afraid of knowing android doesn't have a native api to record voice calls. even the streams are abstracted in Operating System and inaccessible in application layer as Emmanuel hase stated. I consider it as a Serious mistake of Android Devs. if a security Wall have one tiny Hole its not secure any more. So even if droid restricts or tries to restricts there exists other phones where one can have such kind of functionality. even a custom droid kernel can have such kind of functionality. This only makes droid Users poor nothing else.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!