Problem with downloading/saving files in Android 11+

Hi everyone!

I hope you’re all doing well. I’m currently facing a challenge with my Android app and I could really use some guidance from the community.

Here’s the issue: I’m working on an Android app where I need to download/save files to the device’s storage so that they are accessible to the user. I’m using Capacitor for the development. However, I’ve encountered a problem when trying to save these files to the right location.

I already tried Filesystem.writeFile from ‘@capacitor/filesystem’ and the only thing i can do is to save to /storage/emulated/0/Android/data/my_app/files/img.jpg

Here i can see my file but only in Android Studio.

I’m trying to let the user to save file as it could be done in iOS (using Directory.ExternalStorage), so he can access it directly though native Files app

I’ve already declared the necessary permissions in my AndroidManifest.xml for reading and writing to external storage. But, despite that, I’m still either getting errors or file don’t seem to be saved as expected.

Here’s a link to newly created issue on stackoverflow - Problem with downloading/saving files in Android 11+ - Stack Overflow

If anyone has encountered a similar issue or has any insights on how to correctly save files to Android storage, I would greatly appreciate your assistance. Your expertise would be of great help!