cordova读取android库图像



我一直在SDK29上使用相同的代码,以前也使用过,现在我已经更新到目标SDK30,从手机图像库中选择图像时收到ERR_ACCESS_DENIED消息。均设置在Config.xml 中

<config-file target="app/src/main/AndroidManifest.xml" parent="/manifest" overwrite="true">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<button onClick='receiptPhotos.getPhoto(this, pictureSource.PHOTOLIBRARY);'>Photo Library</button>

navigator.camera.getPicture(function(imageURI) {receiptPhotos.onPhotoURISuccess(imageURI, $element);}, receiptPhotos.onFail, { quality: $quality, targetWidth:$targetWidth, targetHeight:$targetHeight, destinationType: Camera.DestinationType.FILE_URI, sourceType: $source , encodingType:Camera.EncodingType.JPEG,mediaType:Camera.MediaType.PICTURE, correctOrientation: true});

onPhotoURISuccess: function (imageURI,$element) {   
...
img.src=imageURI;
...
}

ERR_ACCESS_DENIED: 
file:///data/user/0/com.App.Demo/cache/Screenshot_20220224-102846_image.jpg?1647872951452

我是否需要添加另一个config.xml权限?

我认为这是因为SDK30中文件的权限发生了更改+您可以将添加到config.xml

<preference name="AndroidInsecureFileModeEnabled" value="true" />

问题在于日志中未识别的插件

最新更新