我想使用android
marshmallow
录制通话,因为我使用了以下代码
myAudioRecorder = new MediaRecorder();
//myAudioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
myAudioRecorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
myAudioRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
myAudioRecorder.setOutputFile(outputFile);
myAudioRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
但是我的logcat
了 Request requires android.permission.CAPTURE_AUDIO_OUTPUT
E/AudioPolicyIntefaceImpl: getInputForAttr() permission denied: capture not allowed
知道如何在棉花糖上录制电话
答案 0 :(得分:0)
第三方应用不允许此权限。检查此链接。 https://developer.android.com/reference/android/Manifest.permission.html#CAPTURE_AUDIO_OUTPUT
答案 1 :(得分:-1)
您需要在运行时请求权限
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.CAPTURE_AUDIO_OUTPUT},
1);
稍后在
进行处理@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
switch (requestCode) {
case 1: {
for(int i:grantResults){
if(i == PackageManager.PERMISSION_GRANTED){
// do your stuff here.
}
}
}
}