android编程中电话录音不能播放,在Android 7.0中通话录音而不是支持?

320029eabf5857effc6dacddc97f9d39.png

问题是呼叫记录工作正常到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版本.感谢你提前解决方案…

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值