From aa5ecbbe65448800be99f3d26480b51ec5d9700e Mon Sep 17 00:00:00 2001 From: Nidhin Joseph Date: Wed, 16 Oct 2019 03:34:37 +1100 Subject: [PATCH] fix(android): when saving picture to gallery make sure the folder exist (#2016) --- .../main/java/com/getcapacitor/plugin/camera/CameraUtils.java | 1 + 1 file changed, 1 insertion(+) diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/camera/CameraUtils.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/camera/CameraUtils.java index 31a6c546e..e39025301 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/camera/CameraUtils.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/camera/CameraUtils.java @@ -27,6 +27,7 @@ public static File createImageFile(Activity activity, boolean saveToGallery) thr if(saveToGallery) { Log.d(getLogTag(), "Trying to save image to public external directory"); storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); + storageDir.mkdirs(); } else { storageDir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES); }