With my app you can record short audio comments.
final MediaRecorder recorder = new MediaRecorder();
recorder.setMaxDuration(300000);
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
final String path = getOutputAudioFilePath(activity);
recorder.setOutputFile(path);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
try {
recorder.prepare();
} catch (IOException e) {
Toast.makeText(activity,e.getMessage(),Toast.LENGTH_LONG).show();
}
recorder.start();
The app launches "java.lang.RuntimeException: setMaxDuration failed." with a Galaxy S. I have tested this function in many devices and they don't launch this exception. Obviously I have the following permission in the xml Manifest
<uses-permission android:name="android.permission.RECORD_AUDIO" />
What is the problem?