He escrito este código para grabar llamadas. Funciona bien en Android 2.1. En Android 2.2, crea un archivo de salida con 0 bytes.Grabar llamada en Android 2.2
¿Cómo puedo resolver esto?
MediaRecorder _recorder = new MediaRecorder();
public void start() throws IOException {
try {
String state = android.os.Environment.getExternalStorageState();
if (!state.equals(android.os.Environment.MEDIA_MOUNTED)) {
throw new IOException("SD Card is not mounted. It is " + state
+ ".");
}
// make sure the directory we plan to store the recording in exists
File directory = new File(Environment.getExternalStorageDirectory().getAbsolutePath()
+ "/sam.wav").getParentFile();
if (!directory.exists() && !directory.mkdirs()) {
throw new IOException("Path to file could not be created.");
}
_recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
_recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
_recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
setOutputFile(Environment.getExternalStorageDirectory().getAbsolutePath()
+ "/test.wav");
_recorder.prepare();
_recorder.start();
} catch (Exception e) {
e.printStackTrace();
}
}
se está trabajando. Gracias por responder. –
Al menos según la documentación, VOICE_UPLINK tiene el valor constante de 2 y VOICE_DOWNLINK tiene el valor constante de 3, por lo que ORing les devuelve 3 ... Quizás funcione, pero me parece que solo registraría DOWNLINK ... –