Here is the exact exception that’s thrown:
java.io.FileNotFoundException: /mnt/sdcard/example.mp4 (Permission denied)
I literally copied and pasted example code from here. In addition, I also added this little bit of code to format my path correctly:
private String sanitizePath(String path) {
if (!path.startsWith("/")) {
path = "/" + path;
}
if (!path.contains(".")) {
path += ".3gp";
}
return Environment.getExternalStorageDirectory().getAbsolutePath() + path;
}
Here are the permissions included in my manifest:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_VIDEO" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.STORAGE" />
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.front"/>
Am I missing something completely obvious or is it something more?
You might want to check if the phone is in “Mass Storage Mode”.
When USB cable is connected in this mode, you cannot access files on /sdcard.