FileSystem Capacitor Android 10 Issues

sample project and issue documented…

1 Like

found the problem

Apps targeting Android 10 (API level 29) and higher are given scoped access into an external storage device, or scoped storage , by default. Such apps can see only their app-specific directory

the media plugin is writing to the external directory so any app that wants to read the content, cannot read it with having permission to that directory which in Android 10 and beyond, you dont have.

I am not very good at Android so I haven’t been able to hack around inside the capacitor code to see how this issue is resolved with the camera yet

Now i need a solution?

The issue looks like it has been resolved with this PR, where all of the permissions are granted when capacitor loads?

I tested my project without the change to the manifest and it works fine now, so I guess this PR did the trick

fix(android): Filesystem.requestPermissions() not working #2936

I had tried to request permissions using the Capacitor API but it never worked

thanks

No, that PR only allows Filesystem plugin to request the read/write permissions, but even if the user accepts the permissions, the external storage is still not accesible on Android 10 if the app is built with SDK 29.

It can work if you previously installed the same app in the same device but compiled with SDK 28, then when you build with SDK 29 will still work, but if you delete the app and you build with SDK 29 and install, it won’t work.

You can also add android:requestLegacyExternalStorage="true" to the application tag of the AndroidManifest.xml, that will make the external storage work as if it was built with SDK 28.

Hi, there, how can I solve that issue for my project? now SDK 28 is not allowed. I can’t play videos or audio with target sdk 29, when I try to play audio or video I have this error: GET
/storage/emulated/0/Download/Atem.mp3:1 Failed to load resource: net::ERR_ACCESS_DENIED

1 Like

See this for a more complete and updated solution in regards to Cordova Media Capture Plugin - Surfing Github Issues Related To Ionic, Google Maps & Video Capture - Solutions and Source Code - YouTube