NeutrinosPlatform / cordova-plugin-document-scanner

cordova plugin for document scan
https://www.neutrinos.co/
MIT License
85 stars 61 forks source link

New restrictions on storage access in Android 11 #106

Open benediktcarda opened 2 years ago

benediktcarda commented 2 years ago

As Google Play Store already requires target API level 30 for app updates and new publications, I wanted to update my app. I found out that as of API level 30

requestLegacyExternalStorage="true"

which was a recommended workaround for android target API level 29 (https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner/issues/74#issuecomment-728896922) is not allowed anymore.

This results in an error after cropping the image that reads:

open /storage/emulated/0/Pictures/Title - Sun Mar 13 16-23_45 GMT+01_00 2000.jpg: open failed: EACCES (Permission denied)

Theoretically there would be the option to ask for MANAGE_EXTERNAL_STORAGE permission, but this is only possible as of Android 11 and if one wants to publish on Google Play Store the request to use this will probably be rejected by Google.

There seem to be different solutions on how to manage file access now as outlined here: https://developer.android.com/training/data-storage/use-cases#share-media-all but I can't judge what would be applicable to this plugin and definitely it would require the change of the code (and I am not capable to program in Java).