I have written a code to record audio and save it to below file location.
private String getFilename() {
String
Plug in your device and run adb shell
which will get you a command shell on your device. You don't have permission to read /storage/emulated/
but since you know it's in subdirectory 0 just go cd /storage/emulated/0
and you will be able to look around and interact as aspected.
Note: you can use adb
wirelessly as well
Android recommends that you call Environment.getExternalStorageDirectory.getPath()
instead of hardcoding /sdcard/
in path name. This returns the primary shared/external storage directory. So, if storage is emulated, this will return /storage/emulated/0
. If you explore the device storage with a file explorer, the said directory will be /mnt/sdcard
(confirmed on Xperia Z2 running Android 6).
Try This
private String getFilename() {
String filepath = Environment.getExternalStorageDirectory().getPath();
File file = new File(filepath + "/AudioRecorder" );
if (!file.exists()) {
file.mkdirs();
}
return (file.getAbsolutePath() + "/" + System.currentTimeMillis() + ".mp4");
}
if you are using Android device monitor and android emulator : I have accessed following way: Data/Media/0/