diff --git a/src/android/CameraLauncher.java b/src/android/CameraLauncher.java index 0f9b4b0..a8e6fc4 100644 --- a/src/android/CameraLauncher.java +++ b/src/android/CameraLauncher.java @@ -113,7 +113,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect private boolean orientationCorrected; // Has the picture's orientation been corrected private boolean allowEdit; // Should we allow the user to crop the image. - protected final static String[] permissions = { Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE }; + protected final static String[] permissions = { Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE }; public CallbackContext callbackContext; private int numPics; @@ -245,7 +245,8 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect * @param encodingType Compression quality hint (0-100: 0=low quality & high compression, 100=compress of max quality) */ public void callTakePicture(int returnType, int encodingType) { - boolean saveAlbumPermission = PermissionHelper.hasPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE); + boolean saveAlbumPermission = PermissionHelper.hasPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) + && PermissionHelper.hasPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE); boolean takePicturePermission = PermissionHelper.hasPermission(this, Manifest.permission.CAMERA); // CB-10120: The CAMERA permission does not need to be requested unless it is declared @@ -276,7 +277,8 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect } else if (saveAlbumPermission && !takePicturePermission) { PermissionHelper.requestPermission(this, TAKE_PIC_SEC, Manifest.permission.CAMERA); } else if (!saveAlbumPermission && takePicturePermission) { - PermissionHelper.requestPermission(this, TAKE_PIC_SEC, Manifest.permission.READ_EXTERNAL_STORAGE); + PermissionHelper.requestPermissions(this, TAKE_PIC_SEC, + new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}); } else { PermissionHelper.requestPermissions(this, TAKE_PIC_SEC, permissions); }