CB-12368: Fix permission check on Android

The plugin was checking whether camera permission was granted but then
actually requested permission for external storage.

Surprisingly enough this fixed CB-12368.
This commit is contained in:
Sergey Zolotarev 2017-01-27 01:41:56 +06:00 committed by Julio César
parent 0ad5bdd9ff
commit d29c767f07

View File

@ -185,7 +185,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
} }
else if ((this.srcType == PHOTOLIBRARY) || (this.srcType == SAVEDPHOTOALBUM)) { else if ((this.srcType == PHOTOLIBRARY) || (this.srcType == SAVEDPHOTOALBUM)) {
// FIXME: Stop always requesting the permission // FIXME: Stop always requesting the permission
if(!PermissionHelper.hasPermission(this, permissions[0])) { if(!PermissionHelper.hasPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)) {
PermissionHelper.requestPermission(this, SAVE_TO_ALBUM_SEC, Manifest.permission.READ_EXTERNAL_STORAGE); PermissionHelper.requestPermission(this, SAVE_TO_ALBUM_SEC, Manifest.permission.READ_EXTERNAL_STORAGE);
} else { } else {
this.getImage(this.srcType, destType, encodingType); this.getImage(this.srcType, destType, encodingType);