Problems with MediaRecorder class to record audio - prepare() gives an exception - Permission denied?

Add the WRITE_EXTERNAL_STORAGE permission to AndroidManifest.xml.

Up vote 4 down vote favorite share g+ share fb share tw.

I'm new in Android development and I have the next question/problem. I'm playing around with the MediaRecorder class to record just audio from the microphone. I'm following the steps indicated in the official site: developer.android.com/reference/android/... So I have a method that initializes and configure the MediaRecorder object in order to start recording.

Here you have the code: //initializes audio recorder MediaRecorder mrecorder = new MediaRecorder(); //configure the input sources mrecorder. SetAudioSource(MediaRecorder.AudioSource. MIC); //set the output format mrecorder.

SetOutputFormat(MediaRecorder.OutputFormat. THREE_GPP); //set the audio encoding mrecorder. SetAudioEncoder(MediaRecorder.AudioEncoder.

DEFAULT); //specify the output file mrecorder. SetOutputFile("/sdcard/test.3gp"); //prepare for recording try { mrecorder.prepare(); } catch (IllegalStateException e) { e.printStackTrace(); Log. D("Syso".

E.toString()); } catch (IOException e) { e.printStackTrace(); Log. D("Syso". E.toString()); } When I execute this code in the simulator, thanks to logcat, I can see that the method prepare() gives an exception when is called: java.io.

FileNotFoundException: /sdcard/test.3gp (Permission denied) And I have no idea why this is happening. Due to the message of the exception, I've given permissions in the manifest to access to storage by adding the following line to the xml: But this doesn't fix anything and I still get the same exception all the time. The SDCard is mounted according to the emulator, so I have no clue.

Can anyone give me some advise? Thanks in advanced! Android exception audio-recording permission-denied mediarecorder link|improve this question edited Aug 15 '11 at 21:02Jonas12.2k741102 asked Jun 4 '10 at 1:04arakn01061511 75% accept rate.

Thank you very much! – arakn0 Jun 4 '10 at 17:43.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions