[英]Issue in call recording and not supporting in Android 7.0?
问题是呼叫记录工作正常到Android版本6.0.1但它在Android版本之上不能正常工作。
问题: -通话开启1分钟,但录音在2到3秒内停止。
这里联系的Edittext:
edt_attempt_contact.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
final int DRAWABLE_RIGHT = 2;
if (event.getAction() == MotionEvent.ACTION_UP) {
if (event.getX() >= (edt_attempt_contact.getRight() - edt_attempt_contact.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) {
if (!edt_attempt_contact.getText().toString().isEmpty()) {
Intent i = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + edt_attempt_contact.getText().toString()));
try {
startActivity(i);
}catch (SecurityException s){
s.printStackTrace();
}
try {
audioRecord();
} catch (IOException e) {
e.printStackTrace();
}
} else {
Toast.makeText(MainActivity.this, "Attempt Contact Number is required to call", Toast.LENGTH_SHORT).show();
}
return true;
}
}
return false;
}
});
}
以下是呼叫记录的主要代码。
private void audioRecord() throws IOException {
MediaRecorder recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(root + "/"
.concat("_")
.concat(generateUniqueFileName())
.concat(".amr"));
try {
recorder.prepare();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
recorder.start();
}
我已经采取了所有需要权限的Android录音仍然它不能在上面的android 6.0.1版本。感谢你提前解决方案...
您在服务或活动中使用通话录音代码吗?
呼叫记录开始后,活动填写停止,因此如果您的代码处于活动状态,呼叫记录将停止。
Android 7不支持语音通话使用微型
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.