I'm trying to run simple code to create a directory on the external storage picture directory. On 8.1.0 mkdirs keeps returning false and the directory is not created. On 7.1.1 it works just fine. Here's my code:
private void initializePhotoStorageDirectory() {
photoStorageDirectory = new File(
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
"FolderName");
if (!photoStorageDirectory.exists()) {
photoStorageDirectory.mkdirs();
}
}
I declare the WRITE_EXTERNAL_STORAGE and I made sure the permission is granted during testing and, as I mentioned above, it's working on 7.1.1, so this doesn't looks like a permissions issue.
What am I doing wrong here?