how to call the default voice recorder app programmatically for android phone?

4k views Asked by At

i'm trying to create an app that allows voice recording. i hope to call the default voice recorder app just like how i call the camera app. what i wanted is my app will intent/call the default app. after recording, it will return immediately to my app (just like what happen when i call for the camera)

the code that i used for calling the camera :

Intent takePictureFromCameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

is there anyway that is close to the code above, where its simple and also achieved what i wanted ?

1

There are 1 answers

4
user370305 On BEST ANSWER

Try this,

Intent recordIntent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
startActivityForResult(recordIntent, RESULT_OK);

And onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
  if (resultCode == Activity.RESULT_OK)
  {
    String theFilePath = data.getData().toString();
  }
}