请帮忙,如果您知道如何在Android上录制呼入和呼出电话,请告诉我。
可以做到,只需要这样做。
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!");
}
停止时可以使用
callrecoder.stop();
看这个...
http://androidforums.com/android-lounge/181663-android-phone-call-recording-function.html
简短的回答是...购买一部Galaxy S,最好是韩国版本。
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
这行代码在我的程序中编译良好,其中recorder是一个MediaRecorder对象。我曾经在这样的项目上工作过,但后来该项目被放弃了,所以不确定它是否可行。
很抱歉,您无法在Android上录制电话对话。流数据位于较低级别的操作系统中,应用程序层面无法访问。请谅解。
根据手机型号不同而异。 例如,在Nexus和Motorola手机上,您无法记录通话,因为它们不允许在通话进行时从麦克风录制。但是,在大多数三星和Galaxy设备上,通话期间从麦克风录制相同的内容可以正常工作。
我很担心得知安卓没有本地API来记录语音通话,即使流在操作系统中被抽象化并且在应用层中无法访问,正如Emmanuel所说。我认为这是安卓开发人员的一个严重错误。如果安全墙有一个小洞,它就不再安全了。因此,即使安卓限制或试图限制,仍然存在其他手机可以具有这种功能。甚至自定义的安卓内核也可以具有这种功能。这只会让安卓用户变得更加贫穷,没有其他作用。
MediaRecorder.AudioSource.VOICE_CALL
而不是MediaRecorder.AudioSource.VOICE_COMMUNICATION
进行点赞。 - Yogesh Seralia