Question

I managed to record audio by sending intent with action MediaStore.Audio.Media.RECORD_SOUND_ACTION. But is there a way to tell MediaStore application to automatically start recording without the need for user to press record button? I don't see relevant parameters nor MediaStore.Audio.Media nor in MediaStore.

And same question for video...

Was it helpful?

Solution

You can directly use the MediaRecorder object to record. This way you can control when and how to start the voice recording.

recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(path);
recorder.prepare();
recorder.start();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top