I have to following code to launch and the audio recorder on Android:
final Intent recordSoundIntent = new Intent
("android.provider.MediaStore.RECORD_SOUND");
String fileName = Environment.getExternalStorageDirectory() +
File.separator + UUID.randomUUID() + ".3gpp";
recordSoundIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new
File(fileName)));
startActivityForResult(Intent.createChooser(recordSoundIntent,
getString(R.string.record_sound_chooser)), INTENT_SOUND_RECORDING);
My problem is the following:
My filename (fileName) has no effect, the Uri returned from
data.getData() returns in my last test run: content://media/external/audio/media/41.
However, this file is created on my sdcard: recording34485.3gpp. If it
is not possible to set custom location upon creating sound it is the
location to this file I would like.
Was working on the same problem. Could not find a way to set location directly but found a work around solution of getting and renaming it.
Getting file name was dealt with here, file is then renamed using java.io.File.renameTo(). You’ll need android.permission.WRITE_EXTERNAL_STORAGE in your manifest file for the rename to work.
Here is my test code example: