Search code examples
androidaudioaudio-recordingandroid-mediarecorder

How to launch default audio recording app in android


I want to launch an default audio recording app using intent just by clicking button in android. So how can i do this.

Basically i want to do same as video recording for video recording i have following code.

Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(imageToStore));
startActivityForResult(intent, CAPTURE_VIDEO);

And for Audio recording i have following code.

Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
intent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(imageToStore));
startActivityForResult(intent, CAPTURE_AUDIO);

When i press button to capture video it is opening default camera and i am able to capture video but i am not able to capture audio as it is not opening default audio recording. Does anyone know how to solve this issue.

I have tried following code link but not working.

link1

link2


Solution

  • Yes you are on right path but if you are running in real device then make sure that default android recording app is installed and running, try first with emulator or in some other device if you have and then check.

    Your code is perfect only i did not see any error in this.