呼叫记录器在android 4.1.2上不工作
呼叫录音机在大多数设备上进行录音,但在三星grand上不起作用。意味着在传入或传出时开始录制,并录制来自选定来源(麦克风等)的声音,但其他设备将停止录制声音(这可能是录音机在通话中无法从该来源获取数据的原因(Android的用户隐私问题)) 我已经为此尝试了AudioRecord和MediaRecorder,但问题仍未解决呼叫记录器在android 4.1.2上不工作,android,mediarecorder,audiorecord,Android,Mediarecorder,Audiorecord,呼叫录音机在大多数设备上进行录音,但在三星grand上不起作用。意味着在传入或传出时开始录制,并录制来自选定来源(麦克风等)的声音,但其他设备将停止录制声音(这可能是录音机在通话中无法从该来源获取数据的原因(Android的用户隐私问题)) 我已经为此尝试了AudioRecord和MediaRecorder,但问题仍未解决 private MediaRecorder recorder = null; recorder.setAudioSource(1); recorder
private MediaRecorder recorder = null;
recorder.setAudioSource(1);
recorder.setOutputFormat(1);
recorder.setAudioEncoder(1);
recorder.setOutputFile(path);
recorder.prepare();
recorder.start();
我也尝试了录音,但它对这个问题不起作用。我将发布一个问题代码。这个代码在我的应用程序中非常有效 公共无效启动(Intent Intent,int startId){
但是source MediaRecorder.AudioSource.VOICE_CALL在大多数设备上都不起作用。我认为android不允许录制用户的语音通话。您在清单文件中添加了系统级前置条件。这样您就可以录制语音通话。但它始终显示“权限仅授予系统应用”。请看,我们可以将上行链路和下行链路记录为源,因此我们必须尝试在所有设备上允许的方法,但问题是4.1.2开始记录,但进一步没有从源获取任何数据,并且记录持续时间正在增加,然后停止呼叫记录。我已以这种方式将记录到4.1 android版本。Yas你是r好的。我在HTC one上测试了我的应用程序,它不录制声音。你的问题解决了吗?我也面临着这个问题
mSampleFile = null;
if (mSampleFile == null) {
String newFolder = "/Recording";
String extStorageDirectory = Environment
.getExternalStorageDirectory().toString();
File myNewFolder = new File(extStorageDirectory + newFolder);
if (!myNewFolder.exists()) {
myNewFolder.mkdir();
}
try {
if (myNewFolder != null) {
mSampleFile = File.createTempFile(SAMPLE_PREFIX,
SAMPLE_EXTENSION, myNewFolder);
}
} catch (IOException e) {
}
}
if (mSampleFile != null) {
SharedPreferences mysharedprefs8 = getSharedPreferences(mypref32,
MODE_MULTI_PROCESS);
String status = mysharedprefs8.getString("pass", "AMR_NB");
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
if (status.equalsIgnoreCase("AMR")) {
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB);
} else if (status.equalsIgnoreCase("MPEG")) {
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
} else if (status.equalsIgnoreCase("3GPP")) {
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
} else {
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
}
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
try {
mRecorder.setOutputFile(mSampleFile.getAbsolutePath());
} catch (IllegalStateException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
mRecorder.setMaxDuration(600000);
try {
mRecorder.prepare();
} catch (IllegalStateException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
mRecorder.start();
mRecorder.setOnInfoListener(new OnInfoListener() {
@Override
public void onInfo(MediaRecorder mr, int what, int extra) {
// TODO Auto-generated method stub
try {
mRecorder.stop();
mRecorder.reset();
mRecorder.release();
} catch (Exception e) {
}
}
});
}