Hello, sorry for a question but I can’t believe this thing… With my app I would like to write a very banal image file on the external memory in Android so that it is then visible in the phone gallery. The documentation reads this
The external storage directory On iOS will use the Documents directory On Android it is the primary external/shared storage directory. It is not accessible on Android 10 unless the app enables legacy external storage by adding android:requestLegacyExternalStorage=“true” in the application tag in AndroidManifest.xml. It is not accessible on Android 11 or later.
I mean… I’m full of apps in my phone that write to external storage folder and files, yet capacitor can’t… But how the heck is that possible? Or am I doing it wrong? Thank you
What I was doing is using the cordova-file-opener plugin for this, but after an OS update you have to delete a line for “REQUEST_INSTALL_PACKAGES” from all the manifest files since that was deprecated.
On iOS, you can use the Cordova package as is, or use the Capacitor Share plugin (doesn’t work on Android to my knowledge because it doesn’t let you save on the device like you can on iOS).
That Capacitor Filesystem Plugin mainly works for the internal app files that nobody can access, normally.
Thanks for your reply.
But… Isnt cordova file opener only for open files?
I need to write file on external storage.
Is it possible with this plugin?
Oh right I am a dummy, I totally forgot what I did.
In my case this was my issue. My app created .xlsx and .csv files, and I was using apps that open those files to save to wherever the user wanted. Which is why I used the cordova-file-opener plugin So no, I didn’t fix the issue, or at least how you want it to work. In another project, I used the Share plugin to save locally, but the problem with that process is that on Android it doesn’t have the save option like it does on iOS.
Check the pictures below for the “Save to Files” option. It doesn’t appear on Android. I did find a plugin called Capacitor-File-Opener or something like that, that let me save to Google Drive but that’s about it. I was going to test it on my device to see if I could open files on Google Sheets or MS Excel but right now I am still trying to see if I find a way to do a File Dialog like I can do on Windows.