Capacitor Filesystem not working because it doesn't ask for permission on Android 11

I’m simply trying to read and write to the filesystem, and if I give the permission to access files in memory, through the native settings, everything work fine.

During my research I read that you don’t no longer need to ask for the permission

But if I don’t, the plugin doesn’t ask for the permission, and when I try to writeFile give me messages like:

“FILE_NOTCREATED”

I tried to writeFile to Directory.Documents (as the examples in the Docs), but after some research I gathered the following info:

  • Public folders such as Documents and ExternalStorage are no longer available on Android 11+
  • Directory.Documents uses a native folder that has been deprecated since SDK 29
  • Directory.Documents doesn’t require any permission to read/write on it anymore (at least as long you only read/write your own files).

I also saw recommendations to use Directory.Caches, Directory.Library and Directory.Data, but none of this work for my use case, my app needs to save/read files that can exist anywhere on the device (the user chooses where from).

I also tried Directory.External, and doesn’t work.

So I don’t know where is the “correct” directory to save files, so the user can access them outside the app, and I don’t know how to get the permission to access memory if the plugin doesn’t ask for it?

Capacitor:

Capacitor CLI : 5.5.0
@capacitor/android : 5.5.0
@capacitor/core : 5.5.0
@capacitor/ios : 5.5.0
@capacitor/filesystem: 5.1.4

Here are some links about this topic too:
Capacitor Filesystem error when I try to read a file in Android 11 - Capacitor - Ionic Forum (ionicframework.com)
bug: Capacitor Filesystem returns error while using main functions · Issue #4656 · ionic-team/capacitor (github.com)
Filesystem permissions not working for Android 13 · Issue #1512 · ionic-team/capacitor-plugins (github.com)

PS: I ca’t understand how the github issues are closed, if the problem persists and everyone on the comments still doesn’t have a solution.