How to save file to external storage in Android?

I want to save a file to where my users can have access outside my app.

I’ve tried to use Filesystem, to writeFile to every Directory on the docs, but only Directory.Documents is visible to the users, but this Directory is deprecated since SDK 29 (Filesystem permissions not working for Android 13 · Issue #1512 · ionic-team/capacitor-plugins · GitHub)

For example, File Opener won’t open a pdf saved in Directory.Documents (Android 11)

In iOS, I read that Share Plugin is the native way to save files to a visible folder. I haven’t tested it yet in iOS, but I tried it in Android ad it didn’t work in Android 11.

My conclusion is that Filesystem is a plugin to manage internal app files, and not to save them on the device, so the user can use/edit them outside the app.

What is the solution to that?

2 Likes

I’ve used Filesystem Capacitor plugin to iOS, and Android <= 9, and capacitor-mediastore plugin to Android >= 10.