The problem is this, on versions of android less than 6.0, everything works fine, but at 6.0 and higher, the camera turns on at the touch of a button, a picture is taken. But the directory is not created and accordingly there are no photos in it.
private void saveFullImage() { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (Build.VERSION.SDK_INT >= 23) { if (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { Log.v(TAG, "Permission is granted"); File file = new File(directory.getPath() + "/" + "photo_" + System.currentTimeMillis() + ".jpg"); mOutputFileUri = Uri.fromFile(file); intent.putExtra(MediaStore.EXTRA_OUTPUT, mOutputFileUri); } } else { File file = new File(directory.getPath() + "/" + "photo_" + System.currentTimeMillis() + ".jpg"); mOutputFileUri = Uri.fromFile(file); intent.putExtra(MediaStore.EXTRA_OUTPUT, mOutputFileUri); } startActivityForResult(intent, CAM_REQUEST); } private void createDirectory (){ directory = new File(Environment .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "MyApp"); if (!directory.exists()) directory.mkdirs(); }
DIRECTORY_PICTURESalready have a / at the end? - FlippycreateDirectory()do you havePermission is granted? - woesss